Skip to content

Add devpod status --all - #30

Merged
renatoathaydes merged 3 commits into
mainfrom
claude/devpod-status-all-option-1d4e52
Oct 22, 2026
Merged

renatoathaydes merged 3 commits into
mainfrom
claude/devpod-status-all-option-1d4e52

Conversation

@renatoathaydes

@renatoathaydes renatoathaydes commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

devpod status --all shows the status of all workspaces of the current context in one command:

                      NAME                       | PROVIDER   | STATUS
  -----------------------------------------------+------------+---------
  curity-ai-plugins-devpod-git-identity          | aks        | Stopped
  k8s-ai-plugins                                 | kubernetes | Running
  • Workspaces are ordered most recently used first, like devpod list.
  • Statuses are retrieved concurrently (up to 8 at a time), each within --timeout. A timeout is reported as "timed out after 30s, you can wait longer via --timeout". --container-status still applies. The status of a machine that several workspaces share is only retrieved once.
  • The table, or the hint when there are no workspaces, goes to stdout (like devpod list), so it can be piped; the reasons for Error rows are warnings on stderr. --output json prints a list of the same WorkspaceStatus objects devpod status --output json prints for one workspace.
  • A workspace whose status can't be retrieved, including one whose workspace.json can't be loaded, is still listed:
    • In the plain table it shows as Error with a warning, and after the others are shown the command exits with an error.
    • In JSON it gets a new optional error field, and the command succeeds, because the errors are part of the output and callers can still use the other statuses.
  • --all together with a workspace argument is an error. With no workspaces, plain output prints a hint and JSON prints [].

Why

Checking which dev containers are running used to need one devpod status per workspace.

Notes for reviewers

  • pkg/workspace.ListClients returns a client for each workspace of the context, most recently used first, or the error that prevented it. It loads the providers once, not once per workspace, so warnings about a broken provider aren't repeated for every workspace. ListLocalWorkspaces and loadExistingWorkspace share their directory listing and machine loading with it, and FindProvider shares its lookup.
  • workspace.SortByLastUsed is now the one place for the most-recently-used ordering, used by devpod list too.
  • client.StatusOptions gains MachineStatuses *MachineStatusCache (json:"-"). The workspace client uses it, when set, to share a machine's status between workspaces; every other caller leaves it nil and behaves as before.
  • client.WorkspaceStatus gains Error string \json:"error,omitempty"`, which only --all` sets, so existing JSON output is unchanged.

Testing

  • Ran against real Kubernetes/AKS workspaces. Also tried a 1ms timeout, and, with a temporary DEVPOD_HOME, a workspace with a missing provider, a corrupt workspace.json, no workspaces, an invalid argument and an invalid output format, all in both output formats.
  • The up-docker e2e spec "should start a new workspace with existing image" now also checks that the workspace is Running in status --all; it passes locally.
  • New unit tests cover collecting and printing the statuses (order, errors, per-workspace timeouts, the concurrency limit, cancellation), ListClients, SortByLastUsed and the machine status cache, and pass with -race.
  • golangci-lint is clean on the changed packages, and the unit tests pass.

🤖 Generated with Claude Code

renatoathaydes and others added 3 commits October 22, 2026 15:59
Show the status of all workspaces of the context in one command, as a table
or, with --output json, a list. The statuses are retrieved concurrently
within --timeout. A workspace whose status can't be retrieved is shown as
Error (with an error field in JSON) and makes the command fail after the
others are shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Apply --timeout to each workspace's status, so workspaces waiting for one
  of the concurrent slots no longer time out early, and say that the status
  timed out instead of "context deadline exceeded".
- Succeed with --output json when some statuses failed, since the errors are
  part of the output, so callers can still use the other statuses.
- Load the providers only once instead of once per workspace, which also
  stops repeating their warnings for each workspace.
- Show workspaces whose config can't be loaded as Error instead of
  silently leaving them out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Retrieve the status of a machine that several workspaces share only once
  per `devpod status --all`, via a MachineStatusCache in StatusOptions.
- Print the "no workspaces" hint to stdout with the table, so all of the
  plain output can be redirected; the reasons for errors stay on stderr.
- Share the most-recently-used ordering between devpod list and
  ListClients (workspace.SortByLastUsed) instead of copying it.
- Split RunAll into allStatuses and printStatuses, and add unit tests for
  them, for ListClients, SortByLastUsed and the machine status cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@renatoathaydes
renatoathaydes merged commit b3ee847 into main Oct 22, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant