Skip to content

feat(devbox): support --name/-n on devbox:cleanup:disk - #71126

Merged
skoob13 merged 2 commits into
masterfrom
posthog-code/devbox-cleanup-disk-name-flag
Jul 16, 2026
Merged

feat(devbox): support --name/-n on devbox:cleanup:disk#71126
skoob13 merged 2 commits into
masterfrom
posthog-code/devbox-cleanup-disk-name-flag

Conversation

@skoob13

@skoob13 skoob13 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

hogli devbox:cleanup:disk only ran locally — it had no --name/-n option to target a specific devbox, unlike devbox:exec and the other devbox commands. Raised in this Slack thread.

Changes

Added the shared workspace_argument decorator (positional WORKSPACE plus --name/-n) to devbox:cleanup:disk. When a target is given, the cleanup re-invokes itself remotely on that devbox over ssh via exec_replace, gated on coder_ssh_alias_configured like devbox:exec. Without a target it runs locally as before. The --docker/--cargo flags are forwarded to the remote run.

How did you test this code?

Rendered the command's --help to confirm -n, --name now appears alongside the existing flags, and ran ruff check on the file. Did not exercise the remote ssh path against a live devbox.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored by the PostHog Slack app from a Slack thread. The -n convention was mirrored from devbox:exec, reusing the existing workspace_argument decorator and exec_replace/coder_ssh_alias_configured helpers 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

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
@github-actions

Copy link
Copy Markdown
Contributor

Hey @skoob13! 👋

It looks like your git author email on this PR isn't your @posthog.com address (gtarasov.work@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@skoob13
skoob13 marked this pull request as ready for review July 15, 2026 16:08
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 15, 2026 16:09
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Security Review

The new remote path can run destructive cleanup against a shared workspace without validating that the current user owns it.

Reviews (1): Last reviewed commit: "feat(devbox): support --name/-n on devbo..." | Re-trigger Greptile

Comment thread tools/hogli-commands/hogli_commands/devbox/cli.py Outdated
Comment thread tools/hogli-commands/hogli_commands/devbox/cli.py Outdated
_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"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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
@trunk-io

trunk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@skoob13
skoob13 merged commit 00ad15d into master Jul 16, 2026
171 checks passed
@skoob13
skoob13 deleted the posthog-code/devbox-cleanup-disk-name-flag branch July 16, 2026 08:48
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-16 09:18 UTC Run
prod-us ✅ Deployed 2026-07-16 09:33 UTC Run
prod-eu ✅ Deployed 2026-07-16 09:33 UTC Run

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.

2 participants