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
Create internal/brain/connection.go — wraps one vector-go-sdk connection to one robot. Handles the persistent dial, reconnection on failure, and exposes the SDK client.
typeConnectionManagerstruct {
ESNstringIPstring// ...
}
funcNewConnectionManager(esn, ipstring, logger*slog.Logger) *ConnectionManagerfunc (c*ConnectionManager) Start(ctx context.Context) error// begins connect + reconnect loopfunc (c*ConnectionManager) Client() *vectorpb.ExternalInterfaceClient// nil if not connectedfunc (c*ConnectionManager) IsConnected() boolfunc (c*ConnectionManager) State() api.RobotState// last known state snapshotfunc (c*ConnectionManager) Shutdown(ctx context.Context) error
Reconnect logic
On disconnect: wait 2s, retry. Backoff up to 30s max.
Log every reconnect attempt at INFO level.
Never panic on connection failure — always retry.
One connection per robot. Do not create a second.
Notes
Use the WirePod source as reference for how it connects to Vector via the SDK.
The connection uses TLS with certs from WirePod's provisioning — check how WirePod/chipper handles cert loading.
Task: ConnectionManager
Parent epic: #4 (M1 — Robot Connection)
Depends on: #14 (SDK), #15 (Registry)
What to do
Create
internal/brain/connection.go— wraps one vector-go-sdk connection to one robot. Handles the persistent dial, reconnection on failure, and exposes the SDK client.Reconnect logic
Notes
RESERVE_BEHAVIORSis acquired in a separate task (Acquire and hold RESERVE_BEHAVIORS behavior control #17) after connection is established.Definition of done
ConnectionManager.Start()dials robot008093b9,IsConnected()returns true, survives a WirePod restart (reconnects automatically).