feat(devbox): support --name/-n on devbox:cleanup:disk - #71126
Conversation
Lets you target a specific devbox with cleanup:disk instead of only running it locally. When a WORKSPACE (or --name/-n) is given, the cleanup runs remotely on that devbox over ssh, matching the -n convention already used by devbox:exec and friends. Generated-By: PostHog Code Task-Id: bc24c3b4-c010-4c33-9a93-e2fd84cfa401
|
Hey @skoob13! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
|
| _fail( | ||
| "SSH access for devboxes isn't configured. Run `hogli devbox:setup` (it runs `coder config-ssh`), then retry." | ||
| ) | ||
| remote_cmd = ["hogli", "devbox:cleanup:disk"] |
There was a problem hiding this comment.
Remote Command Depends on Matching Hogli Version
When the target devbox has an older hogli installation that does not contain devbox:cleanup:disk, SSH succeeds but this command fails remotely with No such command. The new feature therefore depends on remote CLI rollout matching the local version rather than executing cleanup through a remote-compatible path.
Refuse to run the destructive cleanup against a shared '@user' devbox, and fail with the standard "No devbox found" message when a resolved label doesn't exist instead of an opaque ssh error. Generated-By: PostHog Code Task-Id: bc24c3b4-c010-4c33-9a93-e2fd84cfa401
Problem
hogli devbox:cleanup:diskonly ran locally — it had no--name/-noption to target a specific devbox, unlikedevbox:execand the other devbox commands. Raised in this Slack thread.Changes
Added the shared
workspace_argumentdecorator (positionalWORKSPACEplus--name/-n) todevbox:cleanup:disk. When a target is given, the cleanup re-invokes itself remotely on that devbox over ssh viaexec_replace, gated oncoder_ssh_alias_configuredlikedevbox:exec. Without a target it runs locally as before. The--docker/--cargoflags are forwarded to the remote run.How did you test this code?
Rendered the command's
--helpto confirm-n, --namenow appears alongside the existing flags, and ranruff checkon the file. Did not exercise the remote ssh path against a live devbox.Automatic notifications
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored by the PostHog Slack app from a Slack thread. The
-nconvention was mirrored fromdevbox:exec, reusing the existingworkspace_argumentdecorator andexec_replace/coder_ssh_alias_configuredhelpers rather than adding a bespoke option, so cleanup:disk behaves consistently with the other devbox commands. No skills were required.Created with PostHog from a Slack thread