Repository navigation
Conversation
… replica Ask GetSandbox for the owner replica and send it as x-openshell-replica on ExecSandbox, ExecSandboxInteractive and ForwardTcp. Retry once without the hint when the per-replica route has no healthy endpoint, holding stream input until response headers arrive so the retry only resends the first frame. Part of NVIDIA#4223 Signed-off-by: divesh <dgude@nvidia.com>
This branch has not been deployed
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
The TypeScript SDK now sends exec, interactive exec, and port-forward calls straight to the gateway replica that owns the sandbox's supervisor session, as the CLI already does. Behind an edge proxy with replica routing enabled, this skips the relay hop through a peer replica; without one, the header is ignored and behavior is unchanged.
Related Issue
Part of #4223 (the "Every SDK asks for the owner and sends the replica hint, like the CLI" item, TypeScript portion). Rust is #4790, Go is #4852; Python follows in a separate PR.
Changes
execStream,execInteractive, andforwardalready callGetSandboxfirst; that call now also asks for the owner, so no round trip is added.routing.ts: sendsx-openshell-replicaon those streams and retries once without it when Envoy reports the owner's route has no ready endpoints (same rule as the CLI). Interactive and forward input is held until response headers arrive, so a retry only resends the start/init frame.Release Notes
TypeScript SDK exec and port-forward calls now take the direct route to the sandbox's owner replica when replica routing is enabled.
Testing
mise run sdk:ts:ci: codegen, proto lint, Biome, type check, tests, coverage, build)Note:
forward()on main sendsworkspaceScopeinTcpForwardInit, which only has aworkspacefield, so the gateway rejects it with "workspace name is required". That is pre-existing and not changed here; the forward round trips above were run with that field patched locally.Checklist