Summary
Replace supervisor polling for gateway-owned configuration with bootstrap and live snapshot delivery over the existing reverse ConnectSupervisor session. The rollout is staged and opt-in: polling keeps working until a migration removes it in 0.3.0. Add durable completion tracking so callers can return after commit, or wait for the exact sandbox configuration revision to reach a terminal state.
The persistent supervisor session and its SSH/exec relay substrate landed in PR #867. Warm-pool registration in PR #2460 remains a pre-session identity and activation step. Managed inference routing was removed in PR #3195 and is no longer part of this work.
Resolved design
- Rollout setting: a gateway-owned
config_delivery_mode = "poll" | "push" setting controls the rollout.
- An omitted setting means
poll in 0.1.x and push from 0.2.0. An explicit poll stays valid through 0.2.x.
- 0.3.0 removes polling after a recreate or drain migration.
- In poll mode the push path is dormant.
- Protocol compatibility: supervisors advertise a protocol revision.
- Legacy supervisors are accepted, keep polling, and never receive pushed snapshots.
- Stage 2 negotiates the applied mode in the handshake instead of inferring it from the revision.
- Old and new gateways and supervisors keep working together through 0.2.x.
- Bootstrap: in push mode, push-capable supervisors receive complete sandbox configuration and provider-environment snapshots in
SessionAccepted.
- Stage 1 sends them as a bounded shadow, and polling stays authoritative.
- From Stage 2, supervisors apply the bootstrap before starting gateway-owned runtime state and report the result.
- Live changes: each change is a complete, one-component
ConfigUpdate snapshot, built from authoritative state at delivery time, with session-scoped correlation and ordering. One delivery scheduler bounds the work:
- Admission never drops updates. Repeated publications coalesce, and only the latest state is built and sent.
- Fleet-wide updates (all connected sessions, a workspace, or a provider) walk the connected sandboxes like a cursor. They cannot starve sandbox-scoped updates, which have reserved build capacity.
- Provider changes and credential refreshes rebuild only the sandboxes that attach that provider.
- Each session holds at most one unsent snapshot per component, and heartbeats and relay control go first.
- Delivery starts from a fresh bootstrap after reconnect.
- Standalone and local policy: standalone file-backed operation remains independent. Explicit local policy keeps precedence and returns an observable retained-local-override outcome.
- Cross-replica delivery: the database remains authoritative, and the gateway that owns the live session delivers to it.
- Other replicas send it secret-free hints, and the owner rebuilds from shared state.
- Owner reconciliation and durable fanout intent repair missed hints, owner handoff, and a crash between commit and publication.
- Durable operations: sandbox-scoped policy and settings mutations commit desired state and a durable, non-secret operation atomically.
COMMIT_ONLY returns after commit.
WAIT_FOR_APPLY waits for an exact correlated result or an authoritative terminal lifecycle state.
- Idempotency keys make retries stable.
- A newer delivered revision supersedes older pending operations.
- Recovery: pending operations survive client timeout and gateway restart. Reconciliation rebuilds current snapshots and republishes them with bounded backoff. No database transaction stays open during delivery or waiting.
- Retained and removed RPCs:
GetSandboxConfig, ReportPolicyStatus, SubmitPolicyAnalysis, PushSandboxLogs, and RelayStream keep their existing roles. 0.3.0 removes supervisor polling and the supervisor-only provider-environment fetch RPC after the migration.
Scope
- Define bootstrap, snapshot, update, result, revision, and durable operation contracts.
- Add the gateway rollout setting, and keep legacy supervisors and mixed versions working through 0.2.x.
- Move gateway-backed initialization and live configuration changes to the supervisor stream.
- Bound, coalesce, and prioritize delivery so fleet-wide updates neither drop nor starve sandbox-scoped updates. Rebuild only the sandboxes a change affects.
- Deliver through the session-owning gateway across replicas, with reconciliation for missed hints.
- Add atomic operation persistence, lookup, idempotency, terminal states, bounded waits, and crash-safe reconciliation for sandbox-scoped policy and settings mutations.
- Preserve local source ownership, last-known-good behavior, heartbeat and relay priority, and secret-safe logging.
- Update the CLI, SDKs, tests, architecture documentation, operator documentation, and public troubleshooting skill.
Non-goals
- Removing polling before the 0.3.0 migration.
- Persisting configuration snapshots, credentials, or an event-by-event delivery log.
- Moving status, analysis, logs, or relay bytes onto the shared session protocol.
- A gateway-initiated supervisor RPC server, endpoint discovery, inbound auth or mTLS, Kubernetes networking changes, or a generic transport abstraction.
- In-place supervisor replacement, or changes to multi-replica session ownership itself. Delivery uses the existing owner index.
- Changing supervisor image defaults. Deployment-default cleanup is separate work.
Acceptance criteria
- Compatibility: in poll mode, and for legacy supervisors, configuration behaves as it does with 0.1.0 polling. Old and new gateways, supervisors, and clients keep working together through 0.2.x.
- Bootstrap: in push mode, gateway-backed supervisors apply a complete bootstrap before the gateway marks them initialized. Missing, failed, oversized, timed-out, or revision-mismatched exchanges fail clearly within a bound.
- Live changes: in push mode, live policy, settings, middleware, and provider changes arrive without supervisor polling.
- Duplicate, stale, failed, coalesced, timeout, and reconnect cases preserve correct runtime state.
- Fleet-wide updates never drop or starve sandbox-scoped updates.
- Provider changes rebuild only the sandboxes that attach the provider.
- Durable operations:
COMMIT_ONLY and WAIT_FOR_APPLY expose durable outcomes for the exact policy and settings revision tuple, without holding database locks across network work.
- Operations resolve as applied, inactive, failed, superseded, or cancelled, from correlated results or authoritative lifecycle state.
- Client cancellation does not erase the operation.
- Cross-replica: a write through another gateway replica reaches the session owner through a hint. Reconciliation repairs missed hints and owner handoff.
- Standalone and local policy: standalone supervisors require no gateway session, and explicit local policy remains authoritative.
- RPCs and documentation:
- Retained RPCs remain compatible.
- Supervisor polling and fetch paths are removed only in 0.3.0, after the migration.
- Documentation describes the rollout setting, source ownership, reconciliation, and the operation lifecycle.
Implementation
References
Summary
Replace supervisor polling for gateway-owned configuration with bootstrap and live snapshot delivery over the existing reverse
ConnectSupervisorsession. The rollout is staged and opt-in: polling keeps working until a migration removes it in 0.3.0. Add durable completion tracking so callers can return after commit, or wait for the exact sandbox configuration revision to reach a terminal state.The persistent supervisor session and its SSH/exec relay substrate landed in PR #867. Warm-pool registration in PR #2460 remains a pre-session identity and activation step. Managed inference routing was removed in PR #3195 and is no longer part of this work.
Resolved design
config_delivery_mode = "poll" | "push"setting controls the rollout.pollin 0.1.x andpushfrom 0.2.0. An explicitpollstays valid through 0.2.x.SessionAccepted.ConfigUpdatesnapshot, built from authoritative state at delivery time, with session-scoped correlation and ordering. One delivery scheduler bounds the work:COMMIT_ONLYreturns after commit.WAIT_FOR_APPLYwaits for an exact correlated result or an authoritative terminal lifecycle state.GetSandboxConfig,ReportPolicyStatus,SubmitPolicyAnalysis,PushSandboxLogs, andRelayStreamkeep their existing roles. 0.3.0 removes supervisor polling and the supervisor-only provider-environment fetch RPC after the migration.Scope
Non-goals
Acceptance criteria
COMMIT_ONLYandWAIT_FOR_APPLYexpose durable outcomes for the exact policy and settings revision tuple, without holding database locks across network work.Implementation
pushbecomes the default. 0.3.0: polling is removed after the migration.References