Repository navigation
fix(server): find a finished sandbox's supervisor on any replica - #5667
Merged
Merged
Conversation
After a retained sandbox's main process exits, CreateSshSession and ForwardTcp allow access only while the supervisor is connected. The check looked only at the receiving replica's session map, so on a multi-replica gateway a request that landed on another replica was refused with "sandbox is not ready". This broke `sandbox create -- <cmd>` when the command finished before the CLI attached. Check the supervisor owner record too, the same way relay opening already routes to the owning replica. Run the host-gateway client as the sandbox's main process again, so the k3s-ha row covers the attach. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
|
Label |
TaylorMutch
approved these changes
Nov 17, 2026
TaylorMutch
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at dac3026. No correctness blockers found. The remaining validation gap is that the multi-replica E2E case was skipped in the current CI run.
6 tasks done
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
On a multi-replica gateway, attaching to a sandbox whose main process already finished could fail with
sandbox is not ready. The post-exit check only looked for the supervisor session on the replica that received the request. It now also finds a supervisor connected to another replica, the same way relay opening already routes to the owning replica.This is split out of #4950 so it can land first. #4950 keeps the rest of the post-exit access work.
Related Issue
Part of #4949. Fixes the case in #4949 (comment):
sandbox create -- <short cmd>on thek3s-harow, where the command finished before the CLI attached andCreateSshSessionreached a replica without the supervisor session.Changes
supervisor_session::supervisor_connected: true when this replica holds the session, or when a fresh owner record names a peer replica. On a single-replica gateway it doesn't read the owner record. An owner record that names this replica but has no local session is treated as stale.CreateSshSessionandForwardTcpuse it forCompletedandErrorsandboxes.Readyis unchanged, and so is every other phase.execworkaround from test(tmachine): prepare runner environments for the e2e/rust migration #5277. Thek3s-harow now covers attaching to a finished main process across replicas.Testing
mise run pre-commitpassesNew unit tests cover
supervisor_connectedand the owner-record rule, and the existingCreateSshSessiontest runs against the new check. The host-gateway test compiles. I haven't run it live; the multi-replica case is exercised by thek3s-haCI row.Checklist