fix: show passphrase dialog for newly added SSH hosts#48
Merged
Conversation
When adding a second VPS, connectWithPassphraseFallback skipped the passphrase dialog because the host was not yet in React sshHosts state (upsertSshHost was called but state hadn't refreshed). The guard `host && host.authMethod !== 'password'` short-circuited when host was undefined, falling through to buildSshPassphraseConnectErrorMessage which misleadingly reported 'Passphrase was submitted'. Changes: - Change guard to `(!host || host.authMethod !== 'password')` so the passphrase dialog shows even when the host isn't in state yet - Add passphraseWasSubmitted flag to buildSshPassphraseConnectErrorMessage to distinguish 'passphrase entered but rejected' from 'no passphrase was ever entered' - Add new locale key ssh.publicKeyAuthFailed for the no-passphrase case - Update tests to cover both paths
Keith-CY
approved these changes
Mar 3, 2026
Collaborator
Keith-CY
left a comment
There was a problem hiding this comment.
LGTM — fix is sound. It correctly handles transient missing state when adding a new SSH host and improves SSH failure messaging with an explicit no-passphrase path. No blocking issues found.
Keith-CY
approved these changes
Mar 3, 2026
Collaborator
Keith-CY
left a comment
There was a problem hiding this comment.
LGTM — fix is sound. It correctly handles transient missing sshHosts state when adding a new SSH host and improves SSH failure messaging with an explicit no-passphrase path. No blocking issues found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When adding a second VPS (e.g.
ssh:hetzner-2), the passphrase dialog was not shown. Instead the error immediately displayed:No passphrase was ever actually submitted or prompted for.
Root Cause
In
connectWithPassphraseFallback(App.tsx), the guard was:When
InstallHub.tsxadds a new host, it callsupsertSshHost()then immediatelyconnectRemoteHost(saved.id). But the ReactsshHostsstate hasn't re-rendered yet, sosshHosts.find(h => h.id === hostId)returnsundefined.With
hostbeingundefined, the guard short-circuits tofalse, the passphrase dialog is skipped, and the code falls through tobuildSshPassphraseConnectErrorMessagewhich shows the misleading "Passphrase was submitted" message.Not a passphrase caching issue — each connection in
SshConnectionPoolstores its passphrase independently by host ID and never reuses another host's passphrase.Fix
host &&to(!host || ...)so the passphrase dialog is shown even when the host isn't in React state yet (assume non-password auth for unknown hosts)passphraseWasSubmittedflag tobuildSshPassphraseConnectErrorMessageto distinguish:ssh.publicKeyRejected(existing)ssh.publicKeyAuthFailed(new, no misleading text)ssh.publicKeyAuthFailedin both en.json and zh.jsonFiles Changed
src/App.tsx— guard fix + pass flag to error buildersrc/lib/sshConnectErrors.ts— add optionalpassphraseWasSubmittedparamsrc/locales/en.json/src/locales/zh.json— new locale keysrc/lib/__tests__/sshConnectErrors.test.ts— test both paths