Sitelet https://github.com/microsoft/autogen/pull/8082
Skip to content

fix(grpc): support signal shutdown on Windows - #8082

Open
primorLee wants to merge 1 commit into
microsoft:mainfrom
primorLee:fix/windows-grpc-signal-handler
Open

fix(grpc): support signal shutdown on Windows#8082
primorLee wants to merge 1 commit into
microsoft:mainfrom
primorLee:fix/windows-grpc-signal-handler

Conversation

@primorLee

Copy link
Copy Markdown

Why are these changes needed?

GrpcWorkerAgentRuntime.stop_when_signal() currently calls loop.add_signal_handler() unconditionally. The default Windows event loop does not implement that API, so cross-language workers fail with NotImplementedError instead of waiting for shutdown. The gRPC host has the same signal-registration path.

This change keeps native asyncio signal handlers on supported event loops and falls back to signal.signal() when the event-loop API is unavailable. The fallback schedules shutdown on the owning loop with call_soon_threadsafe, and both paths remove or restore their handlers when waiting finishes. A shared helper keeps worker and host behavior consistent.

Related issue number

Closes #5760

Checks

  • I've included any doc changes needed for https://microsoft.github.io/autogen/. No public API or documentation changes are required.
  • I've added tests corresponding to the changes introduced in this PR.
  • I've made sure all auto checks have passed. CI is pending.

Local validation:

  • pytest -q python/packages/autogen-ext/tests/test_grpc_signal_utils.py — 2 passed on Windows
  • Ruff 0.4.8 format and lint — passed for all four changed files
  • Pyright 1.1.389 — 0 errors for all four changed files
  • strict mypy — 0 errors for the new signal helper

AI assistance: Codex was used to inspect the failing paths, implement the fix, and run the checks above. The final diff and test behavior were reviewed before submission.

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.

running xlang app host on windows, python grpc exception: NotImplementedError

1 participant