Skip to content

v0.1.2 — find dev containers labelled by VS Code on Windows

Choose a tag to compare

@gambtho gambtho released this 13 Aug 14:34
· 2 commits to main since this release

Bug-fix release for a discovery defect found on real use.

The bug

stop reported "no running dev container" for a container running in front of the user, and the pane path's ambiguity check was silently checking an empty set.

Discovery matched on one label:

docker ps -a --filter label=devcontainer.local_folder=<repo-root>

Labels are written once, at container creation. VS Code on Windows creates them with local_folder holding the host's UNC view of the WSL path — \\wsl.localhost\Ubuntu\home\you\repo — which no POSIX repository root can equal.

Nothing repairs it afterward. Compose-based dev containers are reused by Compose's own project name, so devcontainer up kept handing back the VS Code-created container while discovery stayed blind to it: the container looked freshly opened by Herdr and then could not be stopped.

The fix

Discovery now also matches devcontainer.config_file, which the Dev Containers CLI resolves from inside WSL and which therefore holds a POSIX path on those same containers. Both keys stay exact-match — reconstructing the UNC form from WSL_DISTRO_NAME was rejected as guessing at how the host renders a path. Docker ANDs repeated --filter label arguments, so this is a second docker ps whose results are unioned and collapsed by container id.

Hardening on the same axis

Several paths could report a container as absent when the answer was simply unknown. All now say so instead:

  • An unreadable plugin config or an escaping repo-relative config value silently narrowed the search and reported the empty result as fact.
  • A docker ps timeout surfaced as docker command failed: with no detail.
  • A listing truncated by a read error, or by the 64 KiB capture cap, parsed cleanly and was indexed as the complete set of containers.
  • The two lookups are not atomic, so a container that started between them could be retained in its stale exited state.
  • detect already knew which config path existed and discarded it, costing an extra docker ps against a path known to be missing.
  • The multiple-containers error claimed every id carried devcontainer.local_folder=<root> — false in exactly the case it most often reports.

Install

herdr plugin install gambtho/herdr-devcontainer --ref v0.1.2

Full changelog: v0.1.1...v0.1.2