Skip to content

Auto power-on after resize and add 'nodisk' confirmation option#50

Open
gwpl wants to merge 1 commit intotrailofbits:mainfrom
VariousForks:resize-ux-poweron-nodisk
Open

Auto power-on after resize and add 'nodisk' confirmation option#50
gwpl wants to merge 1 commit intotrailofbits:mainfrom
VariousForks:resize-ux-poweron-nodisk

Conversation

@gwpl
Copy link
Contributor

@gwpl gwpl commented Mar 23, 2026

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.

  • nodisk confirmation escape hatch — When disk resize would increase disk size, the confirmation prompt offers yes/nodisk/no instead of yes/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

# Scale up for a build — "nodisk" keeps it reversible
$ dropkit resize my-box --size s-4vcpu-8gb
...
Are you sure you want to resize this droplet? [yes/nodisk/no] (no): nodisk
Disk resize skipped — CPU/RAM only (you can resize back down later)
...
✓ Resize completed successfully

Powering on droplet...
✓ Power on action started (ID: 3105287233)
Waiting for droplet to power on...
✓ Droplet powered on successfully

Droplet my-box has been resized to s-4vcpu-8gb and is now active

# Later, scale back down — works because disk was never resized
$ dropkit resize my-box --size s-1vcpu-1gb

Technical notes

  • The nodisk option only appears when relevant: disk flag is true (default) AND the new size has a larger disk
  • Power-on uses the same pattern as dropkit on: 120s timeout, action ID validation, console.status() spinner
  • If the power-on action ID can't be obtained, falls back to a warning with manual instructions
  • Confirmed via DigitalOcean API spec: no power_on_after_resize parameter exists — two sequential API calls (resize → power_on) is the only path

Test plan

  • uv run ruff check dropkit/main.py — all checks passed
  • uv run ruff format --check dropkit/main.py — already formatted
  • uv run ty check dropkit/main.py — all checks passed
  • uv run pytest tests/ -v — 288 tests passed, 31% coverage (above 29% minimum)
  • Manual test: dropkit resize <name> --size <bigger> — verify nodisk option appears, auto power-on works
  • Manual test: dropkit resize <name> --size <bigger> --no-disk — verify nodisk option does NOT appear (already skipping disk)
  • Manual test: dropkit resize <name> --size <same-disk-size> — verify nodisk option does NOT appear (no disk change)
  • Manual test: resize then confirm droplet is active without needing 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

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>
@gwpl gwpl requested a review from ret2libc as a code owner March 23, 2026 22:15
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