Small pointers from a shallow read, in case they save time:
- The alias itself is stored, so nothing is lost. What breaks is that the target resolved from
ssh -Gat add time is persisted alongside it (packages/client-runtime/src/connection/onboarding.ts,prepareSshRegistration), and the stored port then takes precedence over the freshly resolved one on reconnect (packages/ssh/src/tunnel.ts,ensureEnvironment). - Because that stored port is passed explicitly to
sshas-p(packages/ssh/src/command.ts,baseSshArgs), it overrides thePortcurrently declared for the alias in the ssh config. - The saved target seems to have no way to distinguish a port the user typed from a port that was resolved automatically, which is likely why the snapshot is treated as an intentional override. The username does not have this problem, because it really was typed.
- Worth checking as a side effect of any fix: the remote state key includes host and port (
remoteStateKey), so making the port dynamic again could spawn a new remote state per port change instead of reusing the existing one.
Possibly related, none of them a duplicate: #3533 is the closest precedent, an ssh config directive not being honored. #6198 is a sibling, an SSH alias treated as a real address on another surface. #4144 and #5749 touch the same reconnect path for different reasons.