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
- Start
frontends/wechatapp.py on Linux with the default conductor mode.
- Ensure Conductor is not already listening on
127.0.0.1:8900.
- 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
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.
Bug:
wechatapp.pycrashes on Linux when starting Conductor due to Windows-only subprocess constantsEnvironment
8ea95336511b4648c2ffb713d784541b3b999813frontends/wechatapp.pyReproduction
frontends/wechatapp.pyon Linux with the defaultconductormode.127.0.0.1:8900._cond_forward()to call_start_conductor().Observed behavior
The message handler thread crashes before
conductor.pycan be started:subprocess.DETACHED_PROCESSis Windows-only, andCREATE_NEW_PROCESS_GROUPis also not portable. The code computes these constants before the existingos.name == 'nt'branch can select POSIXstart_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
This is a platform-compatibility bug in the official
wechatapp.pyConductor forwarding path.