Hyeonsang Cho 74f6dce489
fix(dev): keep whole worktree paths when serve.sh builds DEERFLOW_ROOTS (#5856)
* fix(dev): keep whole worktree paths when serve.sh builds DEERFLOW_ROOTS

serve.sh collects every deer-flow worktree root so `make stop` / `make dev`
can reclaim the shared dev ports (8001/3000/2026) from a sibling checkout.
It parsed `git worktree list --porcelain` with `awk '{print $2}'`, but that
output does not quote paths, so a worktree at `.../deer flow two` was
recorded as `.../deer`. `_is_deerflow_pid` matches open files against
"<root>/", which the truncated root never satisfies, so a Gateway or
frontend started from that worktree was treated as a foreign process and
the start aborted with "port already in use".

Take the remainder of the line after the `worktree ` key instead. The
dedupe and longest-first ordering that follow are unchanged.

The new test builds a scratch repo with a spaced linked worktree and runs
the DEERFLOW_ROOTS block from serve.sh against it, from both the main
checkout and the spaced one.

* docs(changelog): reference #5856 in the worktree-roots entries

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-09-25 22:49:12 +08:00
..
2026-02-06 17:48:15 +08:00