Repository navigation
fix(ssh): fall back to single-pod read when list omits runtime (#408) - #409
Open
digvijaygunjal wants to merge 2 commits into
Open
digvijaygunjal wants to merge 2 commits into
digvijaygunjal wants to merge 2 commits into
Conversation
digvijaygunjal
force-pushed
the
fix/408-ssh-info-runtime-fallback
branch
from
November 23, 2026 23:45
9ba642b to
459f64c
Compare
…d#408) `ssh info` (and the deprecated `ssh connect` alias) derived pod readiness solely from GetPods(), the /pods list endpoint. That endpoint can omit runtime/ssh fields for a pod that is already running and reachable, while the single-pod GET (/pods/{id}) already reports them -- the exact gap Client.GetPodRuntime's own doc comment describes, and the one internal/waitfor/pod.go already re-reads around for `pod create --wait`. ssh info never got that fallback, so a fully-up pod could be reported as "no container reported yet (image pull, container create or boot)" for as long as the list read lagged behind the single-pod one -- 25+ minutes in the field per runpod#408, despite container logs showing sshd already up. Add the same fallback `pod create --wait` already has: when the listed pod has no runtime, re-read it via GetPodRuntime before deriving state. Added a regression test (TestSSHInfo_FallsBackToSinglePodReadWhenListLagsRuntime) exercising a stubbed list/get divergence, and extended the ssh test stub to serve /pods/<id> so it can simulate that divergence. Not yet e2e-tested against the live API per AGENTS.md's non-negotiable rule -- opening as a draft for that reason; happy to run that pass (costs a live pod) before this is marked ready, or if a maintainer can confirm the fix from the unit test alone. Fixes runpod#408
digvijaygunjal
force-pushed
the
fix/408-ssh-info-runtime-fallback
branch
from
November 23, 2026 23:46
459f64c to
786d884
Compare
digvijaygunjal
marked this pull request as ready for review
November 23, 2026 23:53
Mirror internal/waitfor/pod.go's fresh.ID == podID check on the same fallback read in cmd/ssh.go -- the first version trusted any non-error, non-nil GetPodRuntime response without checking it actually describes the pod being queried. Added two tests: the fallback read failing (confirms the command still falls back to the pre-fix not-ready behavior instead of erroring), and the fallback read returning a different pod's id (confirms it's ignored).
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.
Summary
Closes #408.
ssh info(and the deprecatedssh connectalias) derived pod readiness only fromGetPods(), the/podslist endpoint. That endpoint can omitruntimefor a pod that's already running and reachable, whileGET /pods/{id}already reports it.internal/waitfor/pod.goalready works around this forpod create --waitvia itsPodReaderfallback;ssh infonever got the same fallback, so a fully-up pod could be reported "no container reported yet" for as long as the list read lagged the single-pod one (25+ minutes in the issue).We hit this same list/single-pod divergence ourselves, independent of the issue report: a pod running a job of ours sat reachable over SSH while
ssh inforeported it not ready, and separatelypod listreportedruntimeStatus: initializing/awaiting_containerfor a pod that a single-pod read already showed fully up. Same root cause, two different commands.Fix
When the pod found via the list has no
Runtime, re-read it withclient.GetPodRuntime(pod.ID)before deriving state — same pattern asinternal/waitfor/pod.go, applied at this call site.Changes
cmd/ssh.go: add the fallback read, guarded byfresh.ID == pod.ID— the same checkinternal/waitfor/pod.goalready applies to its version of this read, so a mismatched response is never trusted.cmd/ssh_test.go: extendsshStubto optionally serve/pods/<id>with a response that diverges from the list (simulating the race); three tests — the fallback firing when the list lags, the fallback read failing (falls back to the pre-fix not-ready behavior instead of erroring), and the fallback read returning a different pod's id (ignored).Testing
go build ./...,go vet ./cmd/...— clean.golangci-lint run -c .golangci.yml --new-from-rev=72afce1 ./cmd/...— 0 new findings.go test ./...— full suite passes.go test ./cmd/... -race— passes forcmdand every other package;cmd/transfer'sTestTextReceiveNeverTouchesAnExistingFilefails under-raceon a vendored croc data race, reproduced identically on base commit72afce1with no changes checked out — pre-existing, unrelated to this diff.ssh infothrough boot. Confirmed (via a temporary debug line, not part of this diff) thatGetPodRuntimefires on every poll where the list hadn't caught up yet, and that the single-pod read is what first reports the pod running. Pod deleted immediately after.e2e/test for the race itself: it depends on real backend timing and isn't reliably reproducible on demand in a live test.e2e/cli_test.go's existingTestCLI_PodCreateFromTemplatealready callsssh infoagainst a live pod as a happy-path regression check, andinternal/waitfor/pod.go's identical fallback (added in feat(pod,serverless): add --wait and --wait-timeout to create (CON-689) #317) has the same shape of coverage —TestCLI_PodCreateWaitis also happy-path only, not a dedicated race trigger. This PR's new tests cover the race deterministically instead, via the stubbed server incmd/ssh_test.go.Scope
Only the single-pod path (
ssh info <pod-id>,FindPodConnection). The no-argssh connect/ListConnectionslist path has the same gap but isn't part of #408 and isn't touched here.