Summary
Replace supervisor polling for gateway-owned configuration with bootstrap and live snapshot delivery over the existing reverse ConnectSupervisor session. 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
- Gateway and supervisor use a release-matched internal protocol revision. Mismatched peers fail clearly; there is no polling fallback or mixed-protocol compatibility mode.
- Gateway-backed supervisors establish
ConnectSupervisor before runtime initialization and receive complete sandbox configuration and provider-environment snapshots in SessionAccepted.
- Supervisors apply the bootstrap before starting gateway-owned runtime state. They report the bootstrap result after workload and relay endpoints are ready, and that result gates the gateway initialized state.
- Live changes use complete, one-component
ConfigUpdate snapshots with session-scoped correlation and ordering. Delivery is bounded, coalesces newer desired state, and starts from a fresh bootstrap after reconnect.
- Standalone file-backed operation remains independent. Explicit local policy keeps precedence and returns an observable retained-local-override outcome.
- The database remains authoritative. Local notification is the fast path, while owner reconciliation repairs missed delivery and cross-replica writes.
- 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.
- Pending operations survive client timeout and gateway restart. Reconciliation rebuilds current snapshots and republishes them with bounded backoff. No database transaction remains open during delivery or waiting.
- Keep
GetSandboxConfig, ReportPolicyStatus, SubmitPolicyAnalysis, PushSandboxLogs, and RelayStream on their existing roles. Remove obsolete supervisor polling and the supervisor-only provider-environment fetch RPC.
Scope
- Define bootstrap, snapshot, update, result, revision, and durable operation contracts.
- Move gateway-backed initialization and live configuration changes to the supervisor stream.
- 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 fairness, bounded queues, and secret-safe logging.
- Update the CLI, SDKs, tests, architecture documentation, operator documentation, and public troubleshooting skill.
Non-goals
- Legacy polling fallback or mixed-protocol operation.
- 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 broader multi-replica session ownership.
- Changing supervisor image defaults. Release-matched artifacts remain required and deployment-default cleanup is separate work.
Acceptance criteria
- 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 policy, settings, middleware, and provider changes arrive without supervisor polling. Duplicate, stale, failed, coalesced, timeout, and reconnect cases preserve correct runtime state.
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.
- Writes through another gateway replica eventually reach the session owner through reconciliation.
- Standalone supervisors require no gateway session, and explicit local policy remains authoritative.
- Retained RPCs remain compatible, obsolete supervisor fetch paths are removed, and documentation describes the release boundary, source ownership, reconciliation, and operation lifecycle.
Implementation
References
Summary
Replace supervisor polling for gateway-owned configuration with bootstrap and live snapshot delivery over the existing reverse
ConnectSupervisorsession. 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
ConnectSupervisorbefore runtime initialization and receive complete sandbox configuration and provider-environment snapshots inSessionAccepted.ConfigUpdatesnapshots with session-scoped correlation and ordering. Delivery is bounded, coalesces newer desired state, and starts from a fresh bootstrap after reconnect.COMMIT_ONLYreturns after commit.WAIT_FOR_APPLYwaits for an exact correlated result or an authoritative terminal lifecycle state. Idempotency keys make retries stable.GetSandboxConfig,ReportPolicyStatus,SubmitPolicyAnalysis,PushSandboxLogs, andRelayStreamon their existing roles. Remove obsolete supervisor polling and the supervisor-only provider-environment fetch RPC.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
References