Files
OpenShell/docs
Divesh c5850d7573 feat(sdk): route Rust SDK exec to the sandbox owner replica (#4790)
* feat(sdk): route Rust SDK exec to the sandbox owner replica

The Rust SDK now does what the CLI already does for long-lived sandbox
calls: it asks the gateway which replica owns the sandbox's supervisor
session, sends that owner in the x-openshell-replica header on
ExecSandbox, and retries once without the header when the edge proxy
reports that the owner's route has no ready endpoints.

The owner is cached per client for 30 seconds, keyed by workspace and
sandbox name, so repeated execs do not add a GetSandbox round trip. A
failed owner lookup sends the call unrouted and leaves any error to the
exec itself.

Part of #4223

Signed-off-by: divesh <dgude@nvidia.com>

* refactor(sdk): share replica routing helpers and address review feedback

Move owner_replica, with_owner_hint, routed_to and retry_unrouted into
openshell-core so the CLI and SDK share one copy. Curated get_sandbox now
caches the owner, owner lookup returns auth and availability errors, and a
routed Unavailable drops the cached owner.

Signed-off-by: divesh <dgude@nvidia.com>

---------

Signed-off-by: divesh <dgude@nvidia.com>
2026-10-28 21:49:05 +00:00
..