Skip to content

feat: keep shared-pool sandbox sessions on their supervisor's gateway #5051

Description

@FrostGod

User Story

I run OpenShell on Kubernetes with several gateway replicas and a shared supervisor pool (supervisor_topology = "gateway"). I need each sandbox's session to sit on the same gateway as its supervisor, so the layout is a simple tree that is easier to operate and to place by topology later.

Problem Statement

A pool sandbox's session is placed on a gateway by a hash of the sandbox ID. Its supervisor attaches to whichever gateway the Service picks. The two rarely match, so one supervisor's sandboxes are spread across every gateway.

flowchart TB
  subgraph Today
    GA1[Gateway A] --- S1[Supervisor 1]
    GB1[Gateway B]
    S1 --- K1[sandbox 1] & K2[sandbox 2]
    K1 -.session.-> GB1
    K2 -.session.-> GA1
  end
  subgraph Wanted
    GA2[Gateway A] --- S2[Supervisor 1]
    S2 --- K3[sandbox 1] & K4[sandbox 2]
    K3 -.session.-> GA2
    K4 -.session.-> GA2
  end
Loading

Impact / Why This Matters

  • Traffic for one supervisor's sandboxes hops between gateways.
  • A gateway failure affects sandboxes whose supervisor lives elsewhere.
  • Placement by tenant, rack, or data center needs a single parent per sandbox.

Proposed Design

  • A pool sandbox's session is served by the gateway that serves its supervisor.
  • When the supervisor moves (gateway crash, restart, takeover), its sandboxes' sessions follow.
  • Sandbox-to-supervisor placement and dedicated supervisors are unchanged.

Acceptance Criteria

  • With 2 gateways and 2 pool supervisors, every pool sandbox's session gateway equals its supervisor's gateway.
  • This still holds after a gateway crash, a supervisor crash, and a rolling restart of the gateways.
  • Exec keeps working on every sandbox throughout.

Alternatives Considered

  • Leave it to the hash ring: it can't know where the supervisor attached.
  • Supervisors place their own sandboxes: they share one token, so the gateway must stay the authority.

Activity

  1. self-assigned this
    on Oct 30, 2026
  2. added this to the OpenShell 0.1.9 milestone on Oct 30, 2026
  3. moved this from In progress to No status in OpenShell Roadmapon Oct 30, 2026
  4. moved this to In progress in OpenShell Roadmapon Oct 30, 2026
  5. added
    state:acceptedA maintainer decided OpenShell should pursue this issue
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:gatewayGateway server and control-plane workarea:supervisorProxy and routing-path workstate:acceptedA maintainer decided OpenShell should pursue this issue

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions