Skip to content

fix: warn at boot when the event loop cannot spawn subprocesses - #311

Closed
mickyarun wants to merge 1 commit into
mainfrom
fix/windows-subprocess-guard
Closed

fix: warn at boot when the event loop cannot spawn subprocesses#311
mickyarun wants to merge 1 commit into
mainfrom
fix/windows-subprocess-guard

Conversation

@mickyarun

Copy link
Copy Markdown
Owner

What this does

On native Windows, running the backend with uvicorn --reload (or --workers) forces a SelectorEventLoop, which cannot spawn subprocesses. Every git call, repository scan, and CLI agent run then raises NotImplementedError from deep inside a request — surfacing as a 500 that the setup wizard blames on the path the user typed. A Windows evaluator was sent hunting for a missing .git in a checkout that had one.

This detects the condition once at startup and logs a loud, actionable remedy (run python dev_server.py, or drop --reload) while the cause is still attributable — instead of letting it resurface later as a mislabelled input error.

Notes

  • The detector names ProactorEventLoop through getattr because that class exists only on Windows — dotted access threw AttributeError on macOS/Linux, i.e. on exactly the platforms the guard must stay silent on. That was a real portability bug in the original draft; it's fixed and covered.
  • CLAUDE.md now documents python dev_server.py as the run command, with the --reload-on-Windows caveat spelled out.

Two adjacent fixes, same theme — a symptom pointing away from its cause

  • Setup wizard add-path errors. It appended a "point to a git checkout" hint to every failure, including 5xx server errors unrelated to the path. It now shows that hint only when the backend actually rejected the path, and says "the server errored" otherwise.
  • Zero-feature synthesis error. The message hard-coded "Claude" and asserted an MCP-registration failure it never verified. On an org using a local provider both are wrong — a different agent ran, and it registers no MCP server at all. It now names the provider that actually ran and quotes the agent's own final words.

Gates

mypy --strict, ruff, vue-tsc clean; 2545 backend tests pass, including new coverage for the event-loop detector (all branches) and the provider-named synthesis message.

A Windows evaluator ran the backend with 'uvicorn --reload', which forces
a SelectorEventLoop. That loop cannot spawn subprocesses, so every git
call, repository scan and CLI agent run raised NotImplementedError from
inside a request — surfacing as a 500 the setup wizard reported as a
problem with the path the user had typed. One evaluator went looking for a
missing .git in a checkout that had one.

Detect the condition once at startup and log a loud, actionable remedy
(run 'python dev_server.py', or drop --reload), where the cause is still
attributable. The detector references ProactorEventLoop through getattr
because that class exists only on Windows; dotted access threw on the very
platforms the guard has to stay quiet on.

Two adjacent fixes carried along, same theme of a symptom pointing away
from its cause:

- The setup wizard appended a git-checkout hint to every add-path failure,
  including 5xx server errors that have nothing to do with the path. It now
  says so only when the backend actually rejected the path.

- A zero-feature synthesis run raised a message hard-coding 'Claude' and
  asserting an MCP-registration failure it never checked. On a local-
  provider org both are wrong — a different agent ran, and it registers no
  MCP server at all. The message now names the provider that ran and quotes
  the agent's own final words.

Signed-off-by: Arun Rajkumar <mickyarunr@gmail.com>
@mickyarun

Copy link
Copy Markdown
Owner Author

Closing — the Windows NotImplementedError this addresses is already resolved for the client via run-command guidance (use python dev_server.py, not uvicorn --reload). The boot-time guard here is preventive, not a fix for a live issue, and it bundled two uncomplained-about changes. Dropping to keep scope tight; the branch is preserved locally if we want the guard later.

@mickyarun mickyarun closed this Jul 30, 2026
@mickyarun
mickyarun deleted the fix/windows-subprocess-guard branch July 30, 2026 14:18
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