Skip to content

Push gateway-owned desired state to supervisors #1731

Description

@pimlock

Summary

Replace steady-state supervisor polling for gateway-owned desired state with push delivery. The gateway publishes effective config and policy, provider environment, and inference route snapshots through a transport-neutral control-delivery abstraction, using the existing reverse ConnectSupervisor session as the first transport.

The persistent supervisor session and its SSH/exec relay substrate landed in PR #867. This issue builds on that foundation. It does not introduce the session itself or move every supervisor-triggered operation onto one shared stream.

Resolved design

  • Push gateway-owned desired state: effective config and policy, provider environment, and inference routes.
  • Keep ReportPolicyStatus and SubmitPolicyAnalysis as unary supervisor-initiated RPCs.
  • Keep PushSandboxLogs as a supervisor-initiated client-streaming RPC.
  • Keep one initial unary bootstrap fetch for compatibility. Remove steady-state polling after push capability negotiation succeeds.
  • Use transport-neutral SupervisorControlDelivery and SupervisorControlResult messages with shared publisher and handler logic.
  • Use capability negotiation so mixed-version peers safely retain legacy bootstrap and polling behavior.
  • Keep DB-backed desired state as the source of truth, with immediate local notification where practical and bounded reconciliation as the correctness backstop.
  • Add only the supervisor-to-gateway acknowledgements needed for pushed desired-state revisions.
  • Leave an optional Kubernetes gateway-initiated supervisor control transport as a follow-up that can reuse the same logical messages and processing paths.

Scope

  • Define transport-neutral desired-state delivery and result messages for config and policy, provider environment, and inference routes.
  • Negotiate push capabilities through the supervisor session handshake.
  • Publish current snapshots after session acceptance and newer snapshots when desired state changes.
  • Apply snapshots idempotently by revision and acknowledge received, applied, or failed outcomes.
  • Separate one-time bootstrap from steady-state polling so negotiated push disables only the polling loop.
  • Preserve safe fallback for old gateways, old supervisors, and operational rollback.
  • Document ordering, acknowledgement, replay, failure, and reconciliation semantics.

Non-goals

  • Moving ReportPolicyStatus, SubmitPolicyAnalysis, or PushSandboxLogs onto ConnectSupervisor.
  • Building generic request and response multiplexing over the supervisor session.
  • Replacing SSH, exec, or RelayStream behavior.
  • Implementing a production gateway-initiated supervisor gRPC server for Kubernetes.
  • Removing the initial unary bootstrap fetch.
  • Fully solving multi-replica ownership beyond the existing session ownership substrate and bounded DB reconciliation.

Acceptance criteria

  • New peers negotiate desired-state push and stop steady-state config, provider-environment, and inference polling.
  • Current snapshots are delivered after session acceptance, and newer revisions are coalesced, retried, and acknowledged safely.
  • Duplicate, out-of-order, failed, and reconnect-replayed deliveries preserve last-known-good state.
  • Old or capability-incompatible peers retain legacy bootstrap and polling behavior.
  • Supervisor-triggered status, analysis, and log RPCs remain independent and tested.
  • Cross-gateway updates eventually reach the session-owning gateway through bounded reconciliation.
  • The architecture documents the desired-state boundary, retained RPCs, compatibility behavior, and fallback state machine.

References

Metadata

Metadata

Assignees

Labels

area:gatewayGateway server and control-plane workarea:inferenceInference routing and configuration workarea:policyPolicy engine and policy lifecycle workarea:sandboxSandbox runtime and isolation workarea:supervisorProxy and routing-path workstate:review-readyReady for human review

Type

No type

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions