wechatapp crashes on Linux: Windows-only subprocess constants in _start_conductor

Author: liebenCreated Aug 27, 2026Updated Aug 27, 2026

Bug: wechatapp.py crashes on Linux when starting Conductor due to Windows-only subprocess constants

Environment

  • OS: Linux
  • Python: 3.12.3
  • GenericAgent commit: 8ea95336511b4648c2ffb713d784541b3b999813
  • File: frontends/wechatapp.py

Reproduction

  1. Start frontends/wechatapp.py on Linux with the default conductor mode.
  2. Ensure Conductor is not already listening on 127.0.0.1:8900.
  3. Send a message, causing _cond_forward() to call _start_conductor().

Observed behavior

The message handler thread crashes before conductor.py can be started:

Traceback (most recent call last):
  File "frontends/wechatapp.py", line 40121, in <thread>
  File "frontends/wechatapp.py", line 40123, in _cond_forward
  File "frontends/wechatapp.py", line 315, in _start_conductor
    flags = (subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |
AttributeError: module 'subprocess' has no attribute 'DETACHED_PROCESS'

subprocess.DETACHED_PROCESS is Windows-only, and CREATE_NEW_PROCESS_GROUP is also not portable. The code computes these constants before the existing os.name == 'nt' branch can select POSIX start_new_session=True.

Expected behavior

On POSIX, skip Windows-only creation flags and use the existing POSIX launch configuration. On Windows, retain the Windows creation flags.

Suggested minimal fix

python
if os.name == 'nt':
    flags = (subprocess.DETACHED_PROCESS |
             subprocess.CREATE_NEW_PROCESS_GROUP |
             getattr(subprocess, 'CREATE_NO_WINDOW', 0))
    kw = {'creationflags': flags}
else:
    kw = {'start_new_session': True}

This is a platform-compatibility bug in the official wechatapp.py Conductor forwarding path.