Skip to content

fix(example): disable uvicorn hot reload on Windows - #2434

Merged
DavdGao merged 2 commits into
agentscope-ai:mainfrom
dvd233:fix/windows-reload-subprocess
Aug 31, 2026
Merged

DavdGao merged 2 commits into
agentscope-ai:mainfrom
dvd233:fix/windows-reload-subprocess

Conversation

@dvd233

@dvd233 dvd233 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #2423.

On Windows, uvicorn.run(..., reload=True) runs the server with use_subprocess=True, which makes uvicorn select a SelectorEventLoop — and SelectorEventLoop does not support asyncio.create_subprocess_exec. Built-in tools that spawn subprocesses (e.g. exec_shell in tool/_builtin/_backend.py) then fail with NotImplementedError, surfacing as the /workspace/skill 500 in the report.

Verified on Windows (uvicorn 0.52.4):

  • reload=True → _WindowsSelectorEventLoop, asyncio.create_subprocess_exec → NotImplementedError
  • reload=False → ProactorEventLoop (uvicorn's default on Windows), subprocesses work

Change: in the examples/agent_service/main.py entry point, disable hot reload when sys.platform == "win32" and print a short note. Other platforms keep reload=True unchanged.

Type of change

  • Bug fix

Checklist

  • I have read the CONTRIBUTING document
  • The change is small and focused on one issue
  • I have verified the fix locally on Windows (see reproduction above)

This PR was prepared with AI coding assistance; the reproduction, patch, and verification were reviewed and run locally by me on a Windows machine.

dvd233 and others added 2 commits August 27, 2026 01:49
On Windows, uvicorn's reload mode forces a SelectorEventLoop, which does
not support asyncio.create_subprocess_exec — built-in tools such as
exec_shell then fail with NotImplementedError (see agentscope-ai#2423).

Disable hot reload when sys.platform == "win32" and print a short note,
keeping the default subprocess-capable ProactorEventLoop. Other platforms
are unaffected.
Fold the is_windows variable and the startup print into the reload
argument itself — uvicorn's own startup log drowns the notice anyway.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvBvzzA12g3S9ww2C7drtN
@DavdGao
DavdGao merged commit ff57a1c into agentscope-ai:main Aug 31, 2026
6 checks passed
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.

[Bug]: windows 启动 NotImplementedError asyncio.create_subprocess_exec(...)

2 participants