Skip to content

Prepare for restart from the menu bar - #26

Merged
mbeczynski merged 1 commit into
mainfrom
feat/menu-prepare-restart
Oct 21, 2026
Merged

mbeczynski merged 1 commit into
mainfrom
feat/menu-prepare-restart

Conversation

@mbeczynski

Copy link
Copy Markdown
Contributor

Adds Prepare for restart to the small menu bar panel, with a confirmation in place. It pauses the backup, detaches the image and waits until everything has reached Google Drive. These are the same steps as cloudmachine-agent prepare-shutdown, now shared in ShutdownPrep.

Bug fixed along the way

The gdrive-attach agent runs every 900 s and attached the detached image again, which undid the preparation. If the Mac was then restarted, fresh Time Machine writes could stay local only. The CLI had the same gap.

The preparation now leaves a marker: boot time plus the time of the preparation. attach-image skips while the marker is active. The skip exits with code 0, not as an error. The marker is active only in the same boot session and for at most 30 min, so a preparation without a restart never leaves Time Machine without a destination for long. An explicit attach from the window and a mount restart clear it.

UI

  • While prepared, the headline reads "Ready for restart - the image is detached on purpose" and the badge is amber, not "Action needed".
  • The panel shows the running action and the result of the last one. Before, a click in the panel showed nothing.

Tests

  • ShutdownPrepTests (7): checks that the marker holds the agent back in the same boot session, and stops holding after a restart, after 30 min, with a clock set back, or with no marker or boot time.
  • Canary: with isActive broken to always return false, 2 of these 7 tests fail.
  • AppStatusHealthTests checks the new headline.
  • swift test 418/418; swift-format lint --strict is clean.
  • The panel was rendered offscreen (ImageRenderer) in four states: idle, confirming, busy, prepared. I did not click it in the live app, because that would detach the real backup.

🤖 Generated with Claude Code

…then

The menu bar panel gets a "Prepare for restart" button (asks once in place):
it pauses the backup, detaches the image and waits until everything has
reached Drive - the same steps as `prepare-shutdown`, now shared in
`ShutdownPrep` and used by both.

The preparation also leaves a marker. The gdrive-attach agent runs every
900 s and attached the detached image again, so a preparation followed by
a restart a few minutes later could leave fresh Time Machine writes local
only - the backlog the preparation exists to prevent. `attach-image` now
skips (not an error) while the marker is active: same boot session and at
most 30 min old, so a preparation without a restart never leaves Time
Machine without a destination for long. An explicit attach from the window
and a mount restart clear it.

While prepared, the headline says the image is detached on purpose and the
badge is amber instead of "Action needed". The panel also shows what the
app is doing and how the last action ended - before, a click there showed
nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbeczynski
mbeczynski merged commit 56b0608 into main Oct 21, 2026
2 checks passed
@mbeczynski
mbeczynski deleted the feat/menu-prepare-restart branch October 21, 2026 08:55
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