From b21792d9bec26e32af70596ba10b49bb4b9784ec Mon Sep 17 00:00:00 2001 From: ZHANG Ning Date: Mon, 30 Mar 2026 20:02:30 +0800 Subject: [PATCH] fix: run uv sync before dev services to keep venv up-to-date (#1626) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dev Docker Compose uses named volumes (langgraph-venv, gateway-venv) to persist .venv across container restarts. Docker only populates named volumes from the image on first creation — subsequent rebuilds do NOT refresh existing volume contents. When new dependencies are added to packages/harness/pyproject.toml (e.g. langchain-anthropic), the stale named volume still contains the old .venv missing the new packages, causing ModuleNotFoundError at runtime. Add `uv sync` before launching both gateway and langgraph services. When deps are already satisfied this is a no-op (~1s), but when the volume is stale it installs missing packages before the service starts. Fixes #1624 Co-authored-by: Willem Jiang --- docker/docker-compose-dev.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose-dev.yaml b/docker/docker-compose-dev.yaml index bd6f75145..672ef413f 100644 --- a/docker/docker-compose-dev.yaml +++ b/docker/docker-compose-dev.yaml @@ -116,7 +116,7 @@ services: APT_MIRROR: ${APT_MIRROR:-} UV_IMAGE: ${UV_IMAGE:-ghcr.io/astral-sh/uv:0.7.20} container_name: deer-flow-gateway - command: sh -c "cd backend && PYTHONPATH=. uv run uvicorn app.gateway.app:app --host 0.0.0.0 --port 8001 --reload --reload-include='*.yaml .env' > /app/logs/gateway.log 2>&1" + command: sh -c "cd backend && uv sync && PYTHONPATH=. uv run uvicorn app.gateway.app:app --host 0.0.0.0 --port 8001 --reload --reload-include='*.yaml .env' > /app/logs/gateway.log 2>&1" volumes: - ../backend/:/app/backend/ # Preserve the .venv built during Docker image build — mounting the full backend/ @@ -170,7 +170,7 @@ services: APT_MIRROR: ${APT_MIRROR:-} UV_IMAGE: ${UV_IMAGE:-ghcr.io/astral-sh/uv:0.7.20} container_name: deer-flow-langgraph - command: sh -c "cd backend && uv run langgraph dev --no-browser --allow-blocking --host 0.0.0.0 --port 2024 --n-jobs-per-worker 10 > /app/logs/langgraph.log 2>&1" + command: sh -c "cd backend && uv sync && uv run langgraph dev --no-browser --allow-blocking --host 0.0.0.0 --port 2024 --n-jobs-per-worker 10 > /app/logs/langgraph.log 2>&1" volumes: - ../backend/:/app/backend/ # Preserve the .venv built during Docker image build — mounting the full backend/