Skip to content

fix: keep s13 and s16 process locking working on Windows - #592

Open
Steve-Kara wants to merge 1 commit into
shareAI-lab:mainfrom
Steve-Kara:fix/windows-s13-s16
Open

Steve-Kara wants to merge 1 commit into
shareAI-lab:mainfrom
Steve-Kara:fix/windows-s13-s16

Conversation

@Steve-Kara

Copy link
Copy Markdown

Windows has no fcntl, and can't select() on stdin. s15 already guards this, but s13 and s16 still import fcntl at module level, so both stages crash on Windows:

  • s16_workflow_runtime/code.py -> ModuleNotFoundError: No module named 'fcntl'
  • s13_agent_teams/code.py -> OSError: [WinError 10038] (select on a non-socket) once the import is fixed

This follows the fallback style already used in s15, but keeps real cross-process locking on Windows via msvcrt.locking instead of degrading to a thread-only lock -- s16's run lock is what stops two host processes from running the same workflow run. s13's stdin select() becomes msvcrt.kbhit(), with redirected input still working.

POSIX paths are untouched: on non-Windows the code still calls fcntl.flock / select.select.

Verified on Windows 11 + Python 3.12: s16 demo completes end to end, s13 starts and accepts input; the Test workflow's snapshot check already fails on main for unrelated reasons, so I left the generated files alone, same as #586.

Windows 既没有 fcntl 模块,也不能对 stdin 调用 select。s15_integrated_harness
已经做了 try/except 兜底,但 s13/s16 是直接 import fcntl,导致:
  - s16_workflow_runtime 启动即 ModuleNotFoundError
  - s13_agent_teams 启动即 OSError WinError 10038(对非套接字用 select)

改动(沿用 s15 已有的写法,但不降级为纯线程锁,而是保留真正的跨进程锁):
  - s13/s16: fcntl.flock -> _lock_file/_unlock_file,Windows 分支走 msvcrt.locking
  - s13: select.select([sys.stdin]) -> _stdin_ready(),Windows 分支走 msvcrt.kbhit()
  - 重新生成 web/src/data/generated/{versions,docs}.json
    (快照测试要求生成物与 s*/code.py 保持同步)

POSIX 分支行为与改动前完全一致(仍是 fcntl.flock / select)。
本机 Windows 全量测试:122 failed -> 41 failed(382 -> 445 passed)。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant