fix: thread Transport/Host through all remote code paths - #139
Merged
Conversation
The audit found that many remote code paths built a k8s-only Config from
saved sessions, bypassing the Transport interface — so SSH sessions
were deleted by the phase poller, could not re-attach after restart,
could not exec/pull/snapshot/stop, and were cleaned up on transient
network failures.
Fixes (all in one pass):
1. pollRemotePhasesCmd: builds Config with Transport/Host, uses
Transport.Status instead of PodPhase. "unreachable" and "unknown"
keep the session (don't delete); only "NotFound" deletes.
2. cleanupStaleRemoteSessions: same — keeps unreachable/unknown, only
drops ended/failed/stopped/notfound.
3. resolveRemoteConfig: threads Transport/Host/LocalDir from saved
session through mergeRemoteConfig + Defaults.
4. attachToRemoteSession (saved): same threading + Defaults so SSH
re-attach works and k8s gets RemoteUser/WorkDir filled.
5. stopRemoteSessionInternal + saved-session stop: uses
FetchWorkdirToDirWithTransport (new) instead of FetchWorkdirToDir;
pull guard on LocalDir (not Context) so SSH can pull; Release via
Transport instead of DeletePod.
6. executeCmdRemoteExec: uses Transport.Exec instead of ExecInPod.
7. executeCmdRemotePhase: uses Transport.Status instead of PodPhase.
8. deleteSession (app.go): uses Transport.Release instead of DeletePod.
9. fetchRemoteWorkdir: refactored to use Transport.Exec (new
fetchRemoteWorkdirWithTransport); FetchWorkdirToDirWithTransport
added for callers with a live Transport.
10. handleRemotePhase: SSH status label uses "host [status]" format;
duplicate UpdateSavedSessionStatus call removed.
Kairo-Kim
approved these changes
Jul 25, 2026
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.
What
The audit found that many remote code paths built a k8s-only Config from saved sessions, bypassing the Transport interface — so SSH sessions were deleted by the phase poller, could not re-attach after restart, could not exec/pull/snapshot/stop, and were cleaned up on transient network failures.
Fixes (10 changes, all Transport/Host threading)
Impact
:remote:exec,:remote:pull,:remote:stop,:remote:phase, and delete all work for SSH.go build/go vetclean;go test ./...green. Follow-up to #125-#138.