3 Commits

Author SHA1 Message Date
voidborne-d
646f0d6747 fix(server): cover nested paths and warn when watchfiles missing
Review feedback on #611:

1. `Path.match` (used by uvicorn to filter reload candidates) does not
   expand `**` on Python < 3.13, so the flat `WareHouse/*` default only
   caught direct children — the agent-generated files that actually
   triggered #569 live at `WareHouse/<project>/<file>` and deeper.
   Expand defaults to multi-depth glob patterns (up to 10 levels) for
   each excluded dir.

2. `--reload-exclude` is only honoured by the watchfiles-backed reloader;
   without watchfiles uvicorn silently falls back to StatReload and
   drops every exclude pattern. Add `watchfiles` to requirements.txt so
   the filter works out of the box, and log a WARNING when --reload
   runs without watchfiles installed instead of failing silently.

Test coverage:
- `TestExcludePatternDepth` parametrised over 4 WareHouse depths plus
  logs/data/node_modules cases; also asserts real source paths like
  `server/app.py` are NOT matched (no over-exclusion regression).
- `TestWatchfilesWarning` covers the new `_watchfiles_available` probe
  and the WARNING log path.

20/20 tests pass; 8 new.
2026-04-24 16:32:27 +08:00
voidborne-d
7c69226bcf fix(server): scope --reload watching to source dirs (#569)
When ``python server_main.py --reload`` was used, uvicorn's default
reload_dirs is the current working directory and StatReload walks the
whole tree for ``*.py`` files. Agent-generated code under
``WareHouse/session_<uuid>/code_workspace/<file>.py`` therefore triggers
a server restart mid-workflow; the webui is left waiting indefinitely
and the in-flight session is cancelled.

The project already ships a warning in both READMEs telling users to
drop ``--reload``, but that is exactly the tool dev loops need.

Fix: pass an explicit ``reload_dirs`` list containing only the server's
Python source folders (check, entity, functions, mcp_example, runtime,
schema_registry, server, tools, utils, workflow) and a matching
``reload_excludes`` set (WareHouse, logs, data, temp, node_modules) so
watchfiles-backed installs also stop observing output directories.

Users can override either list via repeatable ``--reload-dir`` and
``--reload-exclude`` flags.

The reload-kwargs construction is extracted into a pure helper so the
behaviour is unit-tested without spinning up a real server; nine new
tests cover the default behaviour, user overrides, argparse wiring, and
that the returned lists are defensive copies.

README / README-zh have been updated to reflect the new default.

Fixes #569
2026-04-23 20:07:30 +08:00
NA-Wen
f0db945ed3 initial commit of chatdev 2.0 2026-01-07 16:24:01 +08:00