Skip to content

Force off question: Don't quit, and say which guests are already off - #165

Merged
A21-devs merged 4 commits into
mainfrom
fix/force-off-question-cancel
Dec 5, 2026
Merged

A21-devs merged 4 commits into
mainfrom
fix/force-off-question-cancel

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Closes #158
Closes #92

Both issues are about the question Shut down VMs and quit shows when a guest is still up after a minute.

  • Cancel is now Don't quit. By then every guest has had its power button pressed, and the button can't take that back. It only stops the app from quitting. Cancel read like undoing the shutdown. It's still the cancel button (Esc and the window's X do the same thing).
  • The detail says so: "Don't quit keeps the app open, but the guest was already asked to shut down and may still turn off."
  • It names the VMs that already shut down (Shut down and quit: the Force off question doesn't say the others already shut down #92), e.g. "kali, debian are already off." at the top of the detail, so after Don't quit it's no surprise they are off. Nothing is added when every guest is still up.

On the first idea in #158, showing the window: it's already showing. waitForShutdown calls host.show() before it asks, since the question needs the window, and nothing hides it after the answer. So after Don't quit the window is up with each VM's status in the library. The missing piece was the wording.

Testing

  • 2 new tests in tests/quitFlow.test.ts: the buttons and the cancel button, the already-off list with three VMs and one stuck, and no list when all are stuck. The existing Cancel tests now click Don't quit.
  • npm run typecheck, npm test (203 pass), npm run build
  • Hidden Electron smoke test: SMOKE OK

…y happened

By the time this question shows, every guest has had its power button
pressed. Cancel read like undoing that, but it only abandons the quit,
and the guests keep shutting down. The button is now Don't quit, and the
detail says the guests were already asked to shut down.

It also names the VMs that did shut down within the wait, so after
Don't quit it isn't a surprise that they are off.
@A21-devs A21-devs added the ui label Dec 5, 2026

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Wording and the off list read well, and the cancel button still maps to the quit being abandoned. One case where the new sentence isn't true.

Comment thread src/main/quitFlow.ts Outdated
// so Don't quit doesn't leave the user wondering where the other VMs went
off.length ? `${off.join(', ')} ${off.length === 1 ? 'is' : 'are'} already off.` : '',
`A guest installing updates on shutdown can take a few minutes. Force off loses anything unsaved inside ${waiting.length === 1 ? 'it' : 'them'}.`,
`Don't quit keeps the app open, but ${waiting.length === 1 ? 'the guest was' : 'the guests were'} already asked to shut down and may still turn off.`

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not every VM in waiting was asked to shut down. pressPower swallows a failed resume/shutdown (no QMP connection) and the VM ends up here with no power button press at all. For that one, "the guest was already asked to shut down and may still turn off" is wrong: it won't turn off on its own, and Wait another minute will never help. The flow should remember which VMs it couldn't reach and say so for those, e.g. that the app couldn't reach it to ask, so Force off is the way to turn it off.

pressPower swallowed a failed shutdown (no QMP connection), and the
question then said that guest was already asked to shut down. It now
returns whether the press went through, and the question says which VMs
the app couldn't reach, and that only Force off will turn those off.
@A21-devs

A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner Author

Right, pressPower hid that. Fixed in 017d96f: it returns false when the press fails on a running guest, shutDownAllAndQuit collects those, and the question splits them out: "The app couldn't reach kali to ask it to shut down, so it won't turn off by itself. Force off is the way to turn it off." The "already asked" sentence only names the guests that really got the press, and is left out when none did.

Two new tests with a fake runner whose shutdown throws for one VM: one with a reachable and an unreachable guest, one with only an unreachable one. npm run typecheck, npm test (205 pass), npm run build.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The fix does what the first review asked: only guests whose press went through are called asked, and the unreached ones get their own sentence. One thing that follows from it.

Comment thread src/main/quitFlow.ts Outdated
]
.filter(Boolean)
.join('\n\n'),
buttons: [MORE, FORCE, STAY],

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

When every guest still up is one the app couldn't reach, the text now says they won't turn off by themselves, but Wait another minute is still the first and default button. Enter then waits a minute for something the question just said won't happen, and asks again. In that case the question should offer only Force off and Don't quit.

@A21-devs

A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner Author

Fixed the second review's point in ed0c8b6: when none of the guests still up got the power button, the buttons are Force off and quit / Don't quit, with Don't quit as the cancel button. With at least one reachable guest the three buttons stay, since another minute can still help that one. The unreachable-only test checks the buttons now. npm run typecheck, npm test (205 pass), npm run build.

…r button

If every guest still up is one the app couldn't reach, waiting can't help,
so the question offers only Force off and Don't quit.
@A21-devs
A21-devs merged commit 03adaad into main Dec 5, 2026
1 check passed
@A21-devs
A21-devs deleted the fix/force-off-question-cancel branch December 5, 2026 20:22
@A21-devs A21-devs mentioned this pull request Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant