fix(ps): list running project containers instead of counting claude processes#21
Merged
Conversation
…rocesses `devcontainer ps` was running `pgrep -c claude` inside the current container, which counted child processes rather than containers. This was confusing — reporting "3 sessions" when 3 claude worker processes existed in one container, while other branch containers were invisible. Now uses `docker ps --filter` to find all running containers matching the project prefix, listing each by name with a total count. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
dlovell
added a commit
that referenced
this pull request
Jun 20, 2026
## Summary - `((count++))` post-increment evaluates to 0 on the first loop iteration, which is falsy in bash arithmetic (exit code 1). Under `set -euo pipefail`, this silently kills the script before any output is printed. - `((++count))` pre-increment evaluates to 1 (truthy), so it succeeds under `set -e`. Regression from #21. ## Test plan - [x] `devcontainer ps` with running containers — lists all and prints correct count - [x] `devcontainer ps` with no running containers — prints `0 containers running` 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01AqKB4zPXLUXkTgQaMjHxDj --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
dlovell
added a commit
that referenced
this pull request
Jun 21, 2026
## Summary - `devcontainer ps` and `devcontainer ps --all` currently produce identical output. PR #21 removed the `--all` branch from the `ps` command, after which the flag was silently consumed by `shift` and ignored — even though shell completions still advertise it. - This restores the `--all` branch: it scans every running Docker container and reports only those with active claude sessions. The default `ps` is unchanged — it still lists this project's containers (filtered by `name=^${PROJECT}-dev-`) with per-container session counts. - Kept the pre-increment fix (`((++count))`) from #22 and updated the `--help` text. No completions change needed; they already listed `ps --all`. ## Test plan - [ ] `devcontainer ps` — lists only this project's containers with session counts - [ ] `devcontainer ps --all` — lists all running containers (across projects) that have a claude session; differs from plain `ps` when other projects are running - [ ] `devcontainer ps --all` with no claude sessions anywhere — prints `0 containers running` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devcontainer pswas runningpgrep -c claudeinside the current container, counting child processes as "sessions". This reported misleading numbers (e.g. "3 sessions" from worker processes) while other branch containers were invisible.docker ps --filter "name=^${PROJECT}-dev-"to list all running containers for the project, showing each by name with a total count.--allflag (which searched across all docker containers for claude processes).Test plan
devcontainer pswith multiple branch containers running — should list each container and show the correct countdevcontainer pswith no containers running — should show0 containers runningdevcontainer --helpreflects updated description🤖 Generated with Claude Code