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
Agents tunnels: auto-reconnect with backoff and wake-triggered retry (#310868)
* Agents tunnels: auto-reconnect with backoff and wake-triggered retry
Tunnel-backed remote agent hosts previously had no auto-reconnect
behavior — on laptop sleep / network drop the tunnel would flip to
Disconnected and stay there until the user manually retried.
This adds a reconnect loop inside TunnelAgentHostContribution:
- Detect Connected→Disconnected transitions for still-cached tunnels
and schedule an immediate reconnect. Only fires when the entry is
explicitly Disconnected — if the entry has been removed (e.g. user
clicked "Remove Remote"), we honour the removal and do not reconnect.
- Exponential backoff on consecutive failures: 1s → 30s cap, up to
10 attempts, then pause.
- Wake-triggered retry: on browser `online` or tab
`visibilitychange` → visible, resume any paused reconnects.
Rate-limited to one resume per 10s so rapid tab toggling can't
hammer a permanently broken endpoint with unbounded attempt bursts.
- Prune all reconnect state when a tunnel is uncached or the
contribution is disposed.
* Review comment
Co-authored-by: Copilot <copilot@github.com>
* Telemetry
Co-authored-by: Copilot <copilot@github.com>
* Clean up
Co-authored-by: Copilot <copilot@github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
comment: 'Tracks individual agent-host tunnel connect attempts for performance and reliability.';
131
+
isReconnect: {classification: 'SystemMetaData';purpose: 'FeatureInsight';isMeasurement: true;comment: 'Whether this attempt was part of a reconnect cycle (true) or an initial connect (false).'};
132
+
attempt: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';isMeasurement: true;comment: 'Attempt number within the current connect session (1-based).'};
133
+
durationMs: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';isMeasurement: true;comment: 'Duration of this individual attempt in milliseconds.'};
134
+
success: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';isMeasurement: true;comment: 'Whether this individual attempt succeeded.'};
135
+
errorCategory: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';comment: 'Category of error when the attempt failed (relayConnectionFailed, auth, network, other); empty on success.'};
comment: 'Tracks overall agent-host tunnel connect session outcomes for reliability.';
159
+
isReconnect: {classification: 'SystemMetaData';purpose: 'FeatureInsight';isMeasurement: true;comment: 'Whether the resolved session was a reconnect cycle (true) or an initial connect (false).'};
160
+
totalAttempts: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';isMeasurement: true;comment: 'Total number of attempts made before resolution.'};
161
+
totalDurationMs: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';isMeasurement: true;comment: 'Total elapsed time from session start to resolution in milliseconds.'};
failureReason: {classification: 'SystemMetaData';purpose: 'PerformanceAndHealth';comment: 'Reason the session terminated without connecting (hostOffline, maxAttemptsReached); empty on success.'};
0 commit comments