fix(xtask): devstack bring-up stops on a compose No such container recreate
What
cargo xtask dev bring-up stops at the first docker compose up failure that isn't a port collision or an unhealthy dependency, and it leaves the stack half-recreated. On 2026-10-03, the pre-push battery for #2162 (closed) (branch feat/2162-afcars-fold-finalize) did a cached rebuild after all 50 validate stages had passed. Its up recreated postgres, postgres-test, keycloak, garage, rabbitmq and the reporting migrate gate, then failed on craig-rules:
Container craig-craig-rules-1 Recreate
Container craig-craig-rules-1 Error response from daemon: No such container: bb2b66c96f4a…
Error: docker compose --profile fault up -d --remove-orphans failed with exit status: 1 (attempt 1/5); stderr: …
error: failed to push some refscargo xtask dev status right after showed the half-recreated stack:
- the infra services and
craig-ruleswere absent; - every other app service was running and unhealthy, with no database or broker;
mock-serverhad exited 137.
The push failed before any test ran, which cost one battery.
Why it stops
bring_up_with_port_retry (xtask/src/devstack.rs) retries only when docker::is_port_collision_error matches (xtask/src/docker.rs:285). up_with_rewait re-runs the same up only for a service_healthy dependency that is still settling (#1799 (closed)). Every other compose failure bails on attempt 1 with whatever state the failed up left behind.
A container that disappears between compose's listing and its recreate is a recoverable case: compose lists containers again on its next up, so it creates the missing one fresh. The recovery was a plain cargo xtask dev start. It ran the same cached-rebuild up, converged in one run (every service healthy, seed verified) and did not reproduce the error; the re-push then went ahead. What removed the container is not determined. The devstack is xtask-only, and the xtask has no way to show a container's state history.
Acceptance criteria
- A compose
upfailure whose stderr carriesNo such containeris classified by a named predicate besideis_port_collision_error, with unit tests over the stderr quoted above and over a port-collision stderr (no cross-match). - On that class, the bring-up re-runs the same
up(same ports, volumes kept), within the existingMAX_ATTEMPTScap. It then converges, or bails with the last stderr. - Any other non-retried compose failure says in its bail message that the stack may be half-recreated, and names
cargo xtask dev startas the recovery. -
local-dev.adoc§ Container Management gains one line on the new retry class.
Context
- Siblings in the same family: #1420 (closed) (a pruned one-shot container), #1799 (closed) (an unhealthy dependency re-wait), #1892 (closed) (an unchanged app container left on a recreated broker).
- The battery log is local to the reporter's machine (
target/2162/push-attempt1.log). The excerpt above covers the relevant lines.