You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run OpenShell gateways with several replicas. A relay request that reaches a supervisor session while the gateway is still setting it up shouldn't make the supervisor drop that session.
Problem Statement
The supervisor treats any first frame other than SessionAccepted, SessionRejected or SessionRedirect as an error and drops the session (crates/openshell-supervisor-process/src/supervisor_session.rs). The gateway registers a session before it acknowledges it, so open_relay can queue a RelayOpen in between, for example while the endpoint-status reset waits for the sandbox mutation lock. Since #4321 keeps a sandbox Ready while its session moves, exec, SSH and forward requests can land in that window during a rolling restart.
#4320 fixed the ordering as part of its session setup rework: registry traffic now goes to a private channel, and its forwarder only starts after SessionAccepted is on the response stream (accept_supervisor_session in crates/openshell-server/src/supervisor_session.rs). No test covers it, though. The guarantee depends on where that forwarder gets spawned, so the next change to session setup could bring the race back without anything failing.
Impact / Why This Matters
If it comes back, a request that arrives mid-roll fails and the supervisor has to reconnect, which is the exact case #4321 made reachable.
Proposed Design
A gateway test that pauses session setup after registration (it holds the sandbox mutation guard that the endpoint-status reset takes), opens a relay, and checks that the stream yields SessionAccepted first and the queued RelayOpen second. Test only, no production change.
Acceptance Criteria
A test fails if a relay queued during session setup reaches the supervisor before SessionAccepted.
Letting the supervisor accept a RelayOpen before the ack. It would have to hold relays for a session it hasn't accepted yet, and supervisors already deployed would still drop the session.
Activity