Auto power-on after resize and add 'nodisk' confirmation option#50
Auto power-on after resize and add 'nodisk' confirmation option#50gwpl wants to merge 2 commits intotrailofbits:mainfrom
Conversation
DigitalOcean leaves droplets powered off after resize, with no API flag
to auto-restart. Previously, `dropkit resize` completed silently with
the droplet off — users had to discover this and run `dropkit on`
manually.
Now the resize command:
1. Automatically powers the droplet back on after resize completes,
using the same pattern as `dropkit on` (with status polling and
progress messages).
2. Offers a "nodisk" answer in the confirmation prompt when disk resize
would increase disk size. This supports the common workflow of
temporarily scaling up CPU/RAM for heavy builds or benchmarks and
scaling back down later — which requires NOT resizing the disk
(disk resize is permanent and prevents future downsizing).
The prompt changes from:
Are you sure? [yes/no]
to:
Are you sure? [yes/nodisk/no]
with a tip explaining the option. The "nodisk" choice only appears
when relevant (disk flag is true AND new size has larger disk).
Expected terminal experience after resize:
✓ Resize completed successfully
Powering on droplet...
✓ Power on action started (ID: 3105287233)
Waiting for droplet to power on...
✓ Droplet powered on successfully
Droplet claude-code-box has been resized to s-2vcpu-4gb and is now active
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ret2libc
left a comment
There was a problem hiding this comment.
Can't you use dropkit resize --no-disk test-resize instead of adding a new option? This will resize the droplet without resizing the disk.
|
Greg: TL;DR — Yes, Let me unpack my thinking here :)
From a TUI UX perspective, With Without: User sees the warning, panics, cancels, has to remember That said, I totally get that "where to draw the line on hand-holding in the CLI" is a judgment call. If you'd prefer to keep it flag-only, an alternative would be a more explicit warning like: "⚠ Disk resize is permanent — you will not be able to downsize later. Re-run with Ultimately my concern is about cognitive-overloaded peers who picked dropkit specifically to reduce the overhead of working with |
|
Ok - I read the code, and the warning is already present there... |
dropkit/main.py
Outdated
| # Confirmation | ||
| # Confirmation — offer "nodisk" escape hatch when disk resize is | ||
| # planned and disk size would increase. This supports the common | ||
| # use case of temporarily scaling up CPU/RAM (e.g. for a heavy | ||
| # build or benchmark) and scaling back down later, which requires | ||
| # NOT resizing the disk (disk resize is permanent/irreversible and | ||
| # prevents future downsizing). | ||
| console.print() | ||
| confirm = Prompt.ask( | ||
| "[yellow]Are you sure you want to resize this droplet?[/yellow]", | ||
| choices=["yes", "no"], | ||
| default="no", | ||
| ) | ||
| show_nodisk_option = disk and isinstance(disk_diff, int) and disk_diff > 0 | ||
|
|
||
| if confirm != "yes": | ||
| if show_nodisk_option: | ||
| console.print( | ||
| "[dim]Tip: Answer 'nodisk' to skip disk resize " | ||
| "(keeps resize reversible for temporary scale-ups)[/dim]" | ||
| ) | ||
| confirm = Prompt.ask( | ||
| "[yellow]Are you sure you want to resize this droplet?[/yellow]", | ||
| choices=["yes", "nodisk", "no"], | ||
| default="no", | ||
| ) | ||
| else: | ||
| confirm = Prompt.ask( | ||
| "[yellow]Are you sure you want to resize this droplet?[/yellow]", | ||
| choices=["yes", "no"], | ||
| default="no", | ||
| ) | ||
|
|
||
| if confirm == "nodisk": | ||
| disk = False | ||
| console.print( | ||
| "[dim]Disk resize skipped — CPU/RAM only (you can resize back down later)[/dim]" | ||
| ) | ||
| elif confirm != "yes": |
There was a problem hiding this comment.
what if we make disk/no-disk an interactive option in case it was not explicitly specified by the user? Something like the size. So instead of disk/no-disk being a boolean, it would be a True/False/None and it would be interactively asked only if it was None.
There was a problem hiding this comment.
AI Assistant: Great suggestion! 🎯 Implemented exactly this.
--disk/--no-disk is now a tri-state (True/False/None). When neither flag is passed, the user gets an interactive question — consistent with how region, size, and image are already handled:
Disk resize is PERMANENT and cannot be undone.
Skipping disk resize keeps the option to downsize later.
Resize disk too? [yes/no] (no):
Defaults to "no" (safe side — preserves ability to downsize). The question only appears when the new size has a different disk size.
The old nodisk escape hatch in the confirmation prompt is removed — this is cleaner and more idiomatic for the CLI. Pushed as 6a73fd8.
Per reviewer feedback, instead of a "nodisk" escape hatch in the
confirmation prompt, make --disk/--no-disk a tri-state (True/False/None).
When neither flag is passed, the user is asked interactively — consistent
with how region, size, and image are already handled.
The interactive question only appears when the new size has a different
disk size. It defaults to "no" (skip disk resize) since disk resize
is permanent and prevents future downsizing.
Flow with no flags:
Changes:
Disk: 25 GB → 80 GB (+55 GB)
Disk resize is PERMANENT and cannot be undone.
Skipping disk resize keeps the option to downsize later.
Resize disk too? [yes/no] (no):
Flow with --no-disk: skips the question, shows "not resized"
Flow with --disk: skips the question, proceeds with disk resize
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
AI Agent with Greg: We got caught with our droplet's pants down — resized it, went to SSH in, and found it sitting there powered off like a server that took an unauthorized coffee break. ☕🔌 Meanwhile, the disk resize nearly ate our ability to scale back down. Two papercuts, one patch.
Auto power-on after resize — DigitalOcean leaves droplets powered off after resize (no API flag exists to change this). The command now automatically powers the droplet back on with progress polling, instead of leaving users to discover a cold droplet and manually run
dropkit on.nodiskconfirmation escape hatch — When disk resize would increase disk size, the confirmation prompt offersyes/nodisk/noinstead ofyes/no. This supports the common workflow of temporarily scaling up CPU/RAM (e.g. for a heavy build) and scaling back down later — which requires NOT resizing the disk (disk resize is permanent and blocks future downsizing).Use case: temporary scale-up
Technical notes
nodiskoption only appears when relevant: disk flag is true (default) AND the new size has a larger diskdropkit on: 120s timeout, action ID validation,console.status()spinnerpower_on_after_resizeparameter exists — two sequential API calls (resize → power_on) is the only pathTest plan
uv run ruff check dropkit/main.py— all checks passeduv run ruff format --check dropkit/main.py— already formatteduv run ty check dropkit/main.py— all checks passeduv run pytest tests/ -v— 288 tests passed, 31% coverage (above 29% minimum)dropkit resize <name> --size <bigger>— verifynodiskoption appears, auto power-on worksdropkit resize <name> --size <bigger> --no-disk— verifynodiskoption does NOT appear (already skipping disk)dropkit resize <name> --size <same-disk-size>— verifynodiskoption does NOT appear (no disk change)dropkit on🤖 Generated with Claude Code — your friendly neighborhood security-conscious AI, now also a sysadmin who remembers to turn the lights back on
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com