Skip to content

chat: reduce cloud sandbox discovery load on the task list - #345216

Merged
Osvaldo Ortega (osortega) merged 9 commits into
mainfrom
osortega/agents/sandbox-discovery-load
Oct 30, 2026
Merged

Osvaldo Ortega (osortega) merged 9 commits into
mainfrom
osortega/agents/sandbox-discovery-load

Conversation

@osortega

@osortega Osvaldo Ortega (osortega) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Part of #345234. Fixes problems 1, 2, 3 and 5 described there; problem 4 (re-reading every sandbox task on reload) stays open as a follow-up.

VS Code's cloud sandbox feature asks the Copilot API for your task list so it knows which cloud sessions to show. Today it asks far more often than it needs to, every open window asks the same way at the same time, and a single bad moment at startup can leave a window on the expensive path for good. This PR changes when and how the client asks, one change per commit, so the service sees a fraction of the traffic and users don't notice a difference.

Problems and fixes

Numbered as in #345234.

1. It turned pages the wrong way

Problem. Long task lists come back in pages, and the server says where the next page is. VS Code ignored that and guessed: "page 2, now page 3…". If the server ever stopped treating those numbers as page numbers, VS Code would ask for the same page over and over until the scan was cancelled.

Fix (1c1305ea120, cloudSandboxApiService.ts). Follow the server's Link: rel="next" header, using the parser the rest of VS Code's GitHub integration already uses. Only the query part of the link is adopted, so requests stay on the same API host and keep the filters a link might leave out. A repeated, foreign, or unreadable link ends that scan and reports it as incomplete (keeping the sessions we already had) instead of looping or quietly pretending it finished.

2. It asked "anything new?" every minute, even while it was being told

Problem. VS Code learns about changed sessions two ways: a live push connection (the server tells us) or asking on a timer. It asked on the timer regardless — every 5 minutes with the push connection, every 60 seconds without it. Each ask is really four requests (repo vs. no repo, archived vs. not), more if the list spans pages, and every open window asked on the same minute, so the server saw the load in bursts.

Fix (61e80da2e98 and c42273c66ba, cloudSandboxSessionContribution.ts). Don't poll at all while the push connection is working — it already reports changes, and reconnecting after a gap catches up anything missed. The timer keeps running so polling resumes within one interval if the connection drops. Without a push connection, poll every 5 minutes, with each window adding up to a minute of random delay (measured from its own last pass) so windows spread out. If polls keep failing, back off up to 15 minutes. Switching back to VS Code or changing the selected host still refreshes right away if the list is stale.

3. Accounts with no sandboxes were polled just as hard

Problem. If you have never created a sandbox, there is nothing for those requests to find — but they ran at the same rate anyway.

Fix (0dd73e6dd62 and 0f8bb05e241, same file). Accounts with no known sandbox only check every 15 minutes. The first sandbox to appear — created here, found by a scan, or announced by the push connection — brings back the 5-minute rhythm, and the timer is re-armed immediately so a changed interval takes effect on the next tick rather than one interval late.

5. One bad moment knocked a window off the push connection for good

Problem. Setting up the push connection takes one request. If that request failed for any reason other than "not available for this account" — a momentary server error, a network blip, a timeout — VS Code gave up on it for the rest of the window's life and polled instead. A failed renewal of a working connection did the same. A local window log showed exactly this: one transient error at startup, then polling until the next reload. Nothing in telemetry showed it either.

Fix (633e294aa8d and 88dbe05364b, cloudSandboxSessionFeed.ts and cloudSandboxTelemetry.ts). Keep trying, slowly. Only "not available for this account" or a corrupt message from the server stops attempts for good. Anything else retries after about a minute, doubling each time up to 30 minutes, with a random spread so windows don't retry together, and never sooner than the server's Retry-After if it sends one. Polling continues until the connection is back, then stops again. A connection that drops after it was working still reconnects within seconds, but if it keeps dropping before staying up for a minute, each further reconnect waits twice as long, up to the same 30-minute ceiling (88dbe05364b) — previously it stayed at a one-minute ceiling for as long as the dropping lasted, up to twice a minute per window. A new cloudSandboxSessionFeed telemetry event records each connection, failure, retry delay and give-up, so we can see how many windows are on the push connection versus polling.

What changes for users

  • With a working push connection: nothing visible. Changes still arrive as they happen; background list requests go from 4 every 5 minutes to 0.
  • Without one: a sandbox created from another client shows up within about 5–6 minutes instead of 1–2, or within about 15 minutes if the account had no sandboxes before. Background requests go from 4 per minute to 4 per 5 minutes (or 4 per 15 minutes).
  • After a transient error at startup: the window gets back on the push connection within the backoff instead of polling until reload.
  • Sessions created in the window, manual refresh, and push notifications behave as before.

Supersedes #344841, which also rewrote the shared Link parser; that part is dropped here in favor of the unchanged platform parser.

How to check

Count GET /agents/tasks* requests from one focused window (Output → Telemetry channel, or a local proxy):

Situation Before After
Push connection working, window in the background 4 requests every 5 min 0
No push connection, account has sandboxes 4 requests every minute 4 every 5 min, plus up to 1 min random delay
No push connection, account has no sandboxes 4 requests every minute 4 every 15 min
Push connection setup fails once (transient server error) polling for the rest of the window's life retries after ~1 min, doubling to 30 min; back on the push connection as soon as one succeeds
Push connection connects but keeps dropping reconnects up to twice a minute, indefinitely first six reconnects within seconds, then doubling (1, 2, 4, 8, 17, 30 min) until a connection stays up for a minute

Whether a window is on the push connection or polling is visible in the [CloudSandboxSessionFeed] lines of the window log and in the cloudSandboxSessionFeed telemetry event (outcome is connected, unavailable, negotiationFailed, socketFailed, disconnected, or invalidMessage, with the consecutive failure count and the next retry delay).

Validation

macOS, Node.js 24.22.1, after npm run build-fast -- --client-only:

  • npm run test-browser-no-install -- --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxSessionFeed.test.ts --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxApiService.test.ts --run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/cloudSandboxAgentHostContribution.test.ts --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/editorCloudSandboxContribution.test.ts --browser chromium --reporter dot — passed, 830 tests. These cover the page-following rules (repeated, foreign and unreadable links), the poll gating, jitter, backoff and idle intervals, and the feed retry pacing, Retry-After handling and telemetry, all with virtual time.
  • npm run eslint -- <changed .ts files> — passed.
  • npm run typecheck-client — passed.
  • npm run valid-layers-check — passed.

Not run: verification against the live service. The exact Link format the service emits for the next page was not inspected, which is why the client adopts whatever query the server advertises rather than assuming a parameter name.

Discovery synthesized page=N for the next request and only checked that a Link header mentioned rel=next, so it could not follow continuation URLs and would re-request the same page indefinitely if the server stopped honoring page numbers. Follow the advertised next link instead, adopting only its query so requests stay on the CORS-enabled endpoint and keep the scope filters a numbered link may omit. A repeated or unparseable continuation fails the scope rather than looping or silently completing a truncated scan.

Co-authored-by: Copilot <[email protected]>
Discovery polled the task list every minute whenever the session feed was not connected, which multiplied list requests across windows and lined them up on the same minute grid. Poll on one five-minute interval regardless of feed state, spread each automatic poll with up to a minute of jitter measured from the latest inventory pass, and raise the failure backoff ceiling so unsuccessful scans still slow down. Focus and host-selection refreshes keep bypassing the timer when discovery is stale.

Co-authored-by: Copilot <[email protected]>
An account with no known sandbox gains nothing from incremental polls between full reconciliations, so poll it only at the full-scan interval until a sandbox appears through discovery, provisioning, or the session feed. Re-arm the poll timer when an inventory pass settles so a changed interval, from backoff or an idle inventory, takes effect on the next tick instead of one interval late.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Feed task reads and local provisioning leave the idle-account timer armed after the first sandbox appears, delaying automatic discovery when feed notifications are unavailable.

1 open issue
What changed in this PR

This PR reduces cloud sandbox task-list traffic by updating pagination and the discovery polling shared by the editor and Agents windows.

Changes:

  • Follow server-provided pagination links while preserving API routing and scope filters, and reject invalid or repeated continuations.
  • Use jittered five-minute polling regardless of feed connectivity, with a fifteen-minute interval for empty accounts and a higher retry ceiling.
  • Update regression tests and discovery documentation.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​editorCloudSandboxContribution.test.ts Makes jitter deterministic and adjusts refresh timing.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​cloudSandboxApiService.test.ts Covers cursor pagination, preserved filters, and invalid continuations.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxSessionContribution.ts Adds unified jittered polling, idle-account cadence, and timer re-arming.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxApiService.ts Follows and validates task-list pagination links.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​cloudSandboxAgentHostContribution.test.ts Updates polling, jitter, idle-account, and backoff tests.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md Documents unified polling and idle-account behavior.

Review effort: Balanced

A connected feed already pushes task changes, and its renewals and reconnects catch up the inventory, so the timer-driven poll only duplicated those reads. Skip it while the feed is connected; the timer keeps ticking so polling resumes within one interval once the feed drops. Focus and host-selection refreshes are unchanged.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Base: 9cc5d493 Current: 5c4e92ca

No screenshot changes.

Only inventory scans re-armed the poll timer, so an account whose first sandbox arrived through local provisioning or a feed task read kept the idle fifteen-minute timer until it fired. Re-arm from the shared environment registration on the empty-to-populated transition, without counting it as an inventory pass.

Co-authored-by: Copilot <[email protected]>
@divya-git03

Copy link
Copy Markdown

Hi Osvaldo,

I came across the cloud sandbox discovery issue and am interested in contributing to one of the follow-up improvements.

I'd particularly like to explore moving discovery onto the shared TasksClient.list() implementation.

Is this follow-up still open for contribution? I'd be happy to investigate the existing implementation and propose a focused PR.

Thank you!

A window whose first session feed negotiation failed for any reason other
than the feed being unavailable for the account, for example a transient
HTTP 503, stopped trying for the rest of its lifetime and fell back to
discovery polling until the next reload or setting toggle. A failed
renewal or reconnect did the same. The feed is the cheapest way for the
service to keep a window current, so every window stuck this way was one
more window on the polling path.

Only an unavailable feed (the service declining it for the account) or an
invalid feed message still stop attempts. Every other failed negotiation
or handshake is retried on a jittered exponential backoff that starts at
about one minute and caps at thirty minutes, and never sooner than a
Retry-After. Dropped sockets keep their faster reconnect backoff; both
share one consecutive-failure counter that resets after a healthy
connection. The first connection after any gap still requests full
reconciliation.

Feed transitions are reported through a new cloudSandboxSessionFeed
telemetry event with a bounded outcome, the consecutive failure count,
the scheduled retry delay, and the rejected negotiation status, so
windows left on polling can be told apart from windows receiving push
updates.

Co-authored-by: Copilot <[email protected]>
@osortega Osvaldo Ortega (osortega) added the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label Oct 30, 2026
@osortega
Osvaldo Ortega (osortega) marked this pull request as ready for review October 30, 2026 19:00
@vs-code-engineering

Copy link
Copy Markdown
Contributor

This PR will be automatically cherry-picked to release/1.144 when merged.

@osortega

Copy link
Copy Markdown
Contributor Author

Divya (@divya-git03) thanks for the offering but a team member is already working on this!

A dropped feed socket reconnected on a 1 s to 60 s jittered backoff and
stayed at that ceiling for as long as the socket kept dropping, because the
failure counter only resets after a connection survives for a minute. A
relay that repeatedly accepts and then closes connections therefore cost
every window a negotiation request, a socket connect and a telemetry event
up to twice a minute, indefinitely.

Share the thirty-minute ceiling of the negotiation retry policy instead: the
first six drops still reconnect within seconds, after which each further
drop keeps doubling the delay (about one, two, four, eight and seventeen
minutes, then thirty) until a connection stays healthy for a minute. The
dropped-socket test now drives the schedule past the old ceiling with
immediately closing sockets, and the flapping bound reflects the lower
rate.

Co-authored-by: Copilot <[email protected]>
The stale focus and host selection test waited exactly one poll interval
before selecting the host, so the automatic poll fired at the same instant
and performed the refresh; the selection found a scan in flight and did
nothing. The assertion held, but for the wrong trigger, both before and
after the interval change.

Give the poll a jitter in this test so that it is due after the inventory
goes stale, and record the trigger of every scan so the final refresh is
proven to come from the host selection.

Co-authored-by: Copilot <[email protected]>
The flapping-socket backoff test let its final socket stay connected so
a healthy minute could reset the backoff. That socket was handed the
shared 8-minute reconnect_after, and because the last reconnect lands at
a jittered time within the 30-minute window, the renewal fired inside a
measured window for roughly half of all runs (afterMaximum 2 / requests
16 on the macOS and Windows gates). Renew an hour out instead so no
renewal can land inside the test.

Also clamp the half-way checkpoint wait in the two jittered-backoff
tests: when a 30-minute window draws the minimum jitter the computed
wait is -1, which the virtual clock rejects.

Test-only; no product behavior changes.

Co-authored-by: Copilot <[email protected]>
@osortega
Osvaldo Ortega (osortega) merged commit b7eceff into main Oct 30, 2026
55 checks passed
@osortega
Osvaldo Ortega (osortega) deleted the osortega/agents/sandbox-discovery-load branch October 30, 2026 20:49
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 30, 2026
@vs-code-engineering vs-code-engineering Bot added the release-cherry-pick Automated cherry-pick between release and main branches label Oct 30, 2026
@vs-code-engineering vs-code-engineering Bot removed the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label Oct 30, 2026
Osvaldo Ortega (osortega) added a commit that referenced this pull request Oct 30, 2026
* chat: follow task-list pagination links during sandbox discovery

Discovery synthesized page=N for the next request and only checked that a Link header mentioned rel=next, so it could not follow continuation URLs and would re-request the same page indefinitely if the server stopped honoring page numbers. Follow the advertised next link instead, adopting only its query so requests stay on the CORS-enabled endpoint and keep the scope filters a numbered link may omit. A repeated or unparseable continuation fails the scope rather than looping or silently completing a truncated scan.

Co-authored-by: Copilot <[email protected]>

* chat: poll sandbox discovery every five minutes with jitter

Discovery polled the task list every minute whenever the session feed was not connected, which multiplied list requests across windows and lined them up on the same minute grid. Poll on one five-minute interval regardless of feed state, spread each automatic poll with up to a minute of jitter measured from the latest inventory pass, and raise the failure backoff ceiling so unsuccessful scans still slow down. Focus and host-selection refreshes keep bypassing the timer when discovery is stale.

Co-authored-by: Copilot <[email protected]>

* chat: slow sandbox discovery polling for accounts without sandboxes

An account with no known sandbox gains nothing from incremental polls between full reconciliations, so poll it only at the full-scan interval until a sandbox appears through discovery, provisioning, or the session feed. Re-arm the poll timer when an inventory pass settles so a changed interval, from backoff or an idle inventory, takes effect on the next tick instead of one interval late.

Co-authored-by: Copilot <[email protected]>

* chat: stop polling sandbox discovery while the session feed is connected

A connected feed already pushes task changes, and its renewals and reconnects catch up the inventory, so the timer-driven poll only duplicated those reads. Skip it while the feed is connected; the timer keeps ticking so polling resumes within one interval once the feed drops. Focus and host-selection refreshes are unchanged.

Co-authored-by: Copilot <[email protected]>

* chat: re-arm the sandbox discovery poll when the first sandbox arrives

Only inventory scans re-armed the poll timer, so an account whose first sandbox arrived through local provisioning or a feed task read kept the idle fifteen-minute timer until it fired. Re-arm from the shared environment registration on the empty-to-populated transition, without counting it as an inventory pass.

Co-authored-by: Copilot <[email protected]>

* chat: retry failed session feed negotiations with a slow backoff

A window whose first session feed negotiation failed for any reason other
than the feed being unavailable for the account, for example a transient
HTTP 503, stopped trying for the rest of its lifetime and fell back to
discovery polling until the next reload or setting toggle. A failed
renewal or reconnect did the same. The feed is the cheapest way for the
service to keep a window current, so every window stuck this way was one
more window on the polling path.

Only an unavailable feed (the service declining it for the account) or an
invalid feed message still stop attempts. Every other failed negotiation
or handshake is retried on a jittered exponential backoff that starts at
about one minute and caps at thirty minutes, and never sooner than a
Retry-After. Dropped sockets keep their faster reconnect backoff; both
share one consecutive-failure counter that resets after a healthy
connection. The first connection after any gap still requests full
reconciliation.

Feed transitions are reported through a new cloudSandboxSessionFeed
telemetry event with a bounded outcome, the consecutive failure count,
the scheduled retry delay, and the rejected negotiation status, so
windows left on polling can be told apart from windows receiving push
updates.

Co-authored-by: Copilot <[email protected]>

* chat: keep backing off session feed sockets that repeatedly drop

A dropped feed socket reconnected on a 1 s to 60 s jittered backoff and
stayed at that ceiling for as long as the socket kept dropping, because the
failure counter only resets after a connection survives for a minute. A
relay that repeatedly accepts and then closes connections therefore cost
every window a negotiation request, a socket connect and a telemetry event
up to twice a minute, indefinitely.

Share the thirty-minute ceiling of the negotiation retry policy instead: the
first six drops still reconnect within seconds, after which each further
drop keeps doubling the delay (about one, two, four, eight and seventeen
minutes, then thirty) until a connection stays healthy for a minute. The
dropped-socket test now drives the schedule past the old ceiling with
immediately closing sockets, and the flapping bound reflects the lower
rate.

Co-authored-by: Copilot <[email protected]>

* chat: assert which trigger refreshes stale sandbox discovery

The stale focus and host selection test waited exactly one poll interval
before selecting the host, so the automatic poll fired at the same instant
and performed the refresh; the selection found a scan in flight and did
nothing. The assertion held, but for the wrong trigger, both before and
after the interval change.

Give the poll a jitter in this test so that it is due after the inventory
goes stale, and record the trigger of every scan so the final refresh is
proven to come from the host selection.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit b7eceff)
Michael Lively (Yoyokrazy) added a commit that referenced this pull request Oct 30, 2026
Signed attestation commit for release/1.144 cherry-pick.

Co-authored-by: Copilot <[email protected]>
Osvaldo Ortega (osortega) added a commit that referenced this pull request Oct 30, 2026
…ist (#345268)

* chat: reduce full scans on sandbox feed renewal (#345063)

Use incremental inventory catch-up after seamless feed renewal while retaining full recovery for connection gaps and periodic reconciliation. Preserve queued refresh intent and report bounded per-scan cost and outcome telemetry.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit a06ebdc)

* chat: back off short-lived session feed connections (#345061)

Reuse the reconnect-delay helper for jittered exponential delays capped at one minute. Reset backoff only after a minute of continuous connection, while retaining the existing stop-after-negotiation-failure behavior.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit dc9e435)

* chat: use server-relative session feed renewal (#345060)

* chat: use server-relative session feed renewal

Prefer the service's relative renewal and expiry durations to avoid rapid reconnects caused by client clock skew. Preserve timestamp-only compatibility, validate timing bounds, and cover the shared-client and IPC paths.

Co-authored-by: Copilot <[email protected]>

* test: give feed metadata cases stable names

Use explicit case labels instead of payload-derived titles so duration cases remain unique and timestamp-based fixtures have stable names across CI reruns.

Co-authored-by: Copilot <[email protected]>

* chat: include feed negotiation time in renewal delay

Start monotonic timing before awaiting feed negotiation so response delivery and account rechecks count toward renewal. Add an injected stopwatch for deterministic coverage of delayed negotiation and WebSocket setup.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit f327482)

* chat: reduce cloud sandbox discovery load on the task list (#345216)

* chat: follow task-list pagination links during sandbox discovery

Discovery synthesized page=N for the next request and only checked that a Link header mentioned rel=next, so it could not follow continuation URLs and would re-request the same page indefinitely if the server stopped honoring page numbers. Follow the advertised next link instead, adopting only its query so requests stay on the CORS-enabled endpoint and keep the scope filters a numbered link may omit. A repeated or unparseable continuation fails the scope rather than looping or silently completing a truncated scan.

Co-authored-by: Copilot <[email protected]>

* chat: poll sandbox discovery every five minutes with jitter

Discovery polled the task list every minute whenever the session feed was not connected, which multiplied list requests across windows and lined them up on the same minute grid. Poll on one five-minute interval regardless of feed state, spread each automatic poll with up to a minute of jitter measured from the latest inventory pass, and raise the failure backoff ceiling so unsuccessful scans still slow down. Focus and host-selection refreshes keep bypassing the timer when discovery is stale.

Co-authored-by: Copilot <[email protected]>

* chat: slow sandbox discovery polling for accounts without sandboxes

An account with no known sandbox gains nothing from incremental polls between full reconciliations, so poll it only at the full-scan interval until a sandbox appears through discovery, provisioning, or the session feed. Re-arm the poll timer when an inventory pass settles so a changed interval, from backoff or an idle inventory, takes effect on the next tick instead of one interval late.

Co-authored-by: Copilot <[email protected]>

* chat: stop polling sandbox discovery while the session feed is connected

A connected feed already pushes task changes, and its renewals and reconnects catch up the inventory, so the timer-driven poll only duplicated those reads. Skip it while the feed is connected; the timer keeps ticking so polling resumes within one interval once the feed drops. Focus and host-selection refreshes are unchanged.

Co-authored-by: Copilot <[email protected]>

* chat: re-arm the sandbox discovery poll when the first sandbox arrives

Only inventory scans re-armed the poll timer, so an account whose first sandbox arrived through local provisioning or a feed task read kept the idle fifteen-minute timer until it fired. Re-arm from the shared environment registration on the empty-to-populated transition, without counting it as an inventory pass.

Co-authored-by: Copilot <[email protected]>

* chat: retry failed session feed negotiations with a slow backoff

A window whose first session feed negotiation failed for any reason other
than the feed being unavailable for the account, for example a transient
HTTP 503, stopped trying for the rest of its lifetime and fell back to
discovery polling until the next reload or setting toggle. A failed
renewal or reconnect did the same. The feed is the cheapest way for the
service to keep a window current, so every window stuck this way was one
more window on the polling path.

Only an unavailable feed (the service declining it for the account) or an
invalid feed message still stop attempts. Every other failed negotiation
or handshake is retried on a jittered exponential backoff that starts at
about one minute and caps at thirty minutes, and never sooner than a
Retry-After. Dropped sockets keep their faster reconnect backoff; both
share one consecutive-failure counter that resets after a healthy
connection. The first connection after any gap still requests full
reconciliation.

Feed transitions are reported through a new cloudSandboxSessionFeed
telemetry event with a bounded outcome, the consecutive failure count,
the scheduled retry delay, and the rejected negotiation status, so
windows left on polling can be told apart from windows receiving push
updates.

Co-authored-by: Copilot <[email protected]>

* chat: keep backing off session feed sockets that repeatedly drop

A dropped feed socket reconnected on a 1 s to 60 s jittered backoff and
stayed at that ceiling for as long as the socket kept dropping, because the
failure counter only resets after a connection survives for a minute. A
relay that repeatedly accepts and then closes connections therefore cost
every window a negotiation request, a socket connect and a telemetry event
up to twice a minute, indefinitely.

Share the thirty-minute ceiling of the negotiation retry policy instead: the
first six drops still reconnect within seconds, after which each further
drop keeps doubling the delay (about one, two, four, eight and seventeen
minutes, then thirty) until a connection stays healthy for a minute. The
dropped-socket test now drives the schedule past the old ceiling with
immediately closing sockets, and the flapping bound reflects the lower
rate.

Co-authored-by: Copilot <[email protected]>

* chat: assert which trigger refreshes stale sandbox discovery

The stale focus and host selection test waited exactly one poll interval
before selecting the host, so the automatic poll fired at the same instant
and performed the refresh; the selection found a scan in flight and did
nothing. The assertion held, but for the wrong trigger, both before and
after the interval change.

Give the poll a jitter in this test so that it is due after the inventory
goes stale, and record the trigger of every scan so the final refresh is
proven to come from the host selection.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit b7eceff)

---------

Co-authored-by: Osvaldo Ortega <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Dmitriy Vasyura <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants