Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(dev-env): make down honours C= and destroy refuses it (MUL-9471) (#10799)

Jiayuan Zhang5600e0dbcd8f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 89d93bd3f2..e5bd579300 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -342,6 +342,7 @@ make up C=api,web,daemon # choose the components
make status # what is running, and whether it is yours
make list # every environment on this machine
make down # stop the processes, keep the data
+make down C=daemon # stop only the listed components
make destroy # stop, then drop the database and free the slot
make gc # collect expired environments or ones whose checkout is gone
```
diff --git a/Makefile b/Makefile
index 65047cce3c..24942ae187 100644
--- a/Makefile
+++ b/Makefile
@@ -70,7 +70,7 @@ endef
##@ Help
help: ## Show available make targets and common local workflows
- @awk 'BEGIN {FS = ":.*## "; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nQuick start:\n \033[36mmake up\033[0m Start this checkout'"'"'s environment (C=api,web,daemon,desktop)\n \033[36mmake status\033[0m Show what is running, and prove it is yours\n \033[36mmake down\033[0m Stop it again, keeping the database\n \033[36mmake check\033[0m Run the full local verification pipeline\n\nCheckout modes:\n Main checkout uses \033[36m.env\033[0m\n Worktrees use \033[36m.env.worktree\033[0m (generate with \033[36mmake worktree-env\033[0m)\n\n"} \
+ @awk 'BEGIN {FS = ":.*## "; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nQuick start:\n \033[36mmake up\033[0m Start this checkout'"'"'s environment (C=api,web,daemon,desktop)\n \033[36mmake status\033[0m Show what is running, and prove it is yours\n \033[36mmake down\033[0m Stop it again, keeping the database (C=daemon stops just that)\n \033[36mmake check\033[0m Run the full local verification pipeline\n\nCheckout modes:\n Main checkout uses \033[36m.env\033[0m\n Worktrees use \033[36m.env.worktree\033[0m (generate with \033[36mmake worktree-env\033[0m)\n\n"} \
/^##@/ {printf "\n\033[1m%s\033[0m\n", substr($$0, 5); next} \
/^[a-zA-Z0-9_.-]+:.*## / {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -164,12 +164,13 @@ selfhost-stop: ## Stop the self-hosted Docker Compose stack
# make up C=desktop Electron against this environment's backend
# make up C=desktop ARGS=--cdp ...signed in, with a DevTools port for Playwright
# make up ARGS=--ephemeral agent-owned, expires, collected by `make gc`
+# make down C=daemon stop only the daemon; api and web keep running
up: ## Start this checkout's environment (C=api,web,daemon,desktop; default api,web)
@bash scripts/dev-env.sh up $(if $(C),--components $(C)) $(ARGS)
-down: ## Stop this environment's processes, keeping its database and profile
- @bash scripts/dev-env.sh down $(ARGS)
+down: ## Stop this environment's processes, keeping its database and profile (C=daemon,...; default all)
+ @bash scripts/dev-env.sh down $(if $(C),--components $(C)) $(ARGS)
status: ## Show what is running for this environment, with proof of identity
@bash scripts/dev-env.sh status $(ARGS)
@@ -178,6 +179,7 @@ list: ## List every registered development environment on this machine
@bash scripts/dev-env.sh list $(ARGS)
destroy: ## Stop this environment, drop its database and profile, free its slot
+ $(if $(C),$(error destroy always removes the whole environment and does not take C=; use `make down C=$(C)` to stop components))
@bash scripts/dev-env.sh destroy $(ARGS)
gc: ## Collect environments whose directory is gone or whose TTL expired
diff --git a/apps/docs/content/docs/developers/contributing.fr.mdx b/apps/docs/content/docs/developers/contributing.fr.mdx
index bdb85fd913..a389ed623a 100644
--- a/apps/docs/content/docs/developers/contributing.fr.mdx
+++ b/apps/docs/content/docs/developers/contributing.fr.mdx
@@ -74,6 +74,7 @@ make up # Démarre l'environnement de ce checkout (C=api,web,daemo
make status # Affiche ce qui tourne et prouve qu'il s'agit de cet environnement
make list # Liste tous les environnements de cette machine
make down # Arrête les processus, conserve la base de données
+make down C=daemon # Arrête uniquement les composants indiqués
make destroy # Arrête, puis supprime la base de données et libère l'emplacement
make gc # Nettoie les environnements expirés ou dont le répertoire n'existe plus
make dev # Prépare et démarre le checkout courant au premier plan
diff --git a/apps/docs/content/docs/developers/contributing.mdx b/apps/docs/content/docs/developers/contributing.mdx
index b2aadfa83d..29c386c24d 100644
--- a/apps/docs/content/docs/developers/contributing.mdx
+++ b/apps/docs/content/docs/developers/contributing.mdx
@@ -74,6 +74,7 @@ make up # Start this checkout's environment (C=api,web,daemon,desk
make status # Show what is running and prove it is this environment
make list # List every environment on this machine
make down # Stop the processes, keep the database
+make down C=daemon # Stop only the listed components
make destroy # Stop, then drop the database and free the slot
make gc # Collect expired or directory-less environments
make dev # Prepare and start the current checkout in the foreground
diff --git a/scripts/dev-env.sh b/scripts/dev-env.sh
index 15a492d2de..9efac25c08 100755
--- a/scripts/dev-env.sh
+++ b/scripts/dev-env.sh
@@ -6,6 +6,7 @@
# make status # what is running, and is it mine
# make list # every environment on this machine
# make down # stop the processes, keep the data
+# make down C=daemon # stop only some components
# make destroy # stop, then delete database + profile + slot
#
# Three rules the old flow got wrong, and why they are here:
@@ -1569,7 +1570,11 @@ cmd_down() {
case " $ALL_COMPONENTS " in *" $comp "*) ;; *) die "Unknown component '$comp'. Valid: $ALL_COMPONENTS" ;; esac
stop_component "$comp"
done
- printf '\n%s✓ %s stopped.%s Database, profile and slot kept — `make up` restarts in seconds.\n' "$C_GREEN" "$NAME" "$C_OFF"
+ if [ "$requested" = "$ALL_COMPONENTS" ]; then
+ printf '\n%s✓ %s stopped.%s Database, profile and slot kept — `make up` restarts in seconds.\n' "$C_GREEN" "$NAME" "$C_OFF"
+ else
+ printf '\n%s✓ %s: stopped %s.%s Other components were left as they were — `make status` shows them.\n' "$C_GREEN" "$NAME" "$requested" "$C_OFF"
+ fi
}
cmd_destroy() {
@@ -1826,8 +1831,9 @@ wide-markdown issue content. desktop starts signed in. --cdp exposes a Chrome
DevTools Protocol port (printed by up and status --json) for Playwright's
connectOverCDP; the port is kept for later runs until --no-cdp.
-down keeps the database, the CLI profile and the allocated slot.
-destroy consumes them.
+down keeps the database, the CLI profile and the allocated slot; with
+--components (make down C=daemon) it stops only those and leaves the rest
+running. destroy consumes them and always acts on the whole environment.
EOF
}
diff --git a/scripts/dev-env.test.sh b/scripts/dev-env.test.sh
index 0eb86b0447..8d7a1a4190 100644
--- a/scripts/dev-env.test.sh
+++ b/scripts/dev-env.test.sh
@@ -346,6 +346,15 @@ if [ "$status" -ne 0 ]; then
fi
require_contains "$out" "stopped"
+# `make down C=daemon` must reach the script as a component filter. Dropping C
+# here stops api and web too, which is what `make up C=...` users do not expect.
+make -s -n -C "$root_dir" down C=daemon > "$out" 2>&1 || fail "make -n down C=daemon failed"
+require_contains "$out" "dev-env.sh down --components daemon"
+if make -s -n -C "$root_dir" destroy C=daemon > "$out" 2>&1; then
+ fail "make destroy C=daemon must refuse instead of destroying the whole environment"
+fi
+require_contains "$out" "make down C=daemon"
+
# Commands launched through env-exec must not inherit the daemon-task identity
# hints that make human/profile CLI commands reject --profile.
write_manifest "clean-env-903" "$root_dir" 903