Skip to content

chat: use server-relative session feed renewal - #345060

Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
mainfrom
dev/dmitriv/cloud-feed-relative-renewal
Oct 30, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 3 commits into
mainfrom
dev/dmitriv/cloud-feed-relative-renewal

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Use the session-feed service's expires_in and reconnect_in millisecond durations instead of comparing its renewal timestamp to the client's wall clock.

  • Preserve the optional relative fields through the typed task client and serialized IPC.
  • Validate the relative fields as a pair, require renewal before expiry, and reject delays that would overflow a native timer.
  • Subtract monotonic WebSocket-setup elapsed time before scheduling renewal.
  • Preserve the existing absolute-timestamp behavior when an older server omits both relative fields.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:45

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

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

Credential renewal timing excludes response-delivery and account-check delays, which can cause renewal to occur after credentials expire.

1 open issue

Review effort: Max

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]>
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]>
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]>
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) force-pushed the dev/dmitriv/cloud-feed-relative-renewal branch from e09761b to 22ff7d4 Compare October 29, 2026 23:51
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) marked this pull request as ready for review October 30, 2026 00:15
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit f327482 into main Oct 30, 2026
56 checks passed
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) deleted the dev/dmitriv/cloud-feed-relative-renewal branch October 30, 2026 00:17
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 30, 2026
Osvaldo Ortega (osortega) pushed a commit that referenced this pull request Oct 30, 2026
* 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)
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants