Skip to content

chat: preserve errors from coalesced session refreshes - #345717

Merged
Osvaldo Ortega (osortega) merged 1 commit into
mainfrom
osortega/agents/session-refresh-errors
Nov 3, 2026
Merged

Osvaldo Ortega (osortega) merged 1 commit into
mainfrom
osortega/agents/session-refresh-errors

Conversation

@osortega

Copy link
Copy Markdown
Contributor

Follow-up to #345710, addressing the error-propagation review comment on #345711. Related to #345234.

Problem

An already-queued resolution can consume a later manual caller's refresh intent before that caller's debounce expires. If that refresh fails, the manual caller can await a different task and incorrectly complete successfully without invoking its error handler. A subsequent successful refresh can also mask the earlier failure. This affects callers such as plugin-link session resolution.

Change

Keep refresh intent, lazy-item resolution, and collected errors in one pending provider batch. Each caller retains that batch and returns its errors, even if an earlier queued task executes it or a later request replaces the caller's delayed task. A batch already executed by the throttler is not executed again.

The change is limited to the sessions model and its regression tests. It preserves manual-refresh precedence, request coalescing, lazy item resolution, and the existing cloud freshness behavior. No public API, configuration, telemetry, or feed behavior changes.

Both the original PR and its release cherry-pick have merged; this draft targets main and will need a separate release backport.

Validation

  • Two new overlap regressions failed before the fix and passed after it, including the case where a later successful refresh replaces the manual caller's delayed task.
  • A third test verifies that coalesced callers each receive the error once, without an extra refresh.
  • 656 Chromium tests passed, with 13 pre-existing skipped tests, across the sessions model, opener, shared service, plugin URL handler, cloud discovery, and telemetry suites.
  • Client transpilation, targeted ESLint, and patch whitespace checks passed.
  • Client type-check remains blocked by the same two pre-existing SDK errors: kerberosAuth is absent from CopilotClientOptions at src/vs/platform/agentHost/node/copilot/copilotAgent.ts(4426,5) (TS2353) and src/vs/platform/agentHost/test/node/copilotAgent.test.ts(14139,61) (TS2339). No new diagnostics.
  • Based on main at 498770fb016918e2f34e586fc5b26a7342f450a1. Full integration/smoke suites and live UI flows were not run.
Exact validation commands and results

Refresh existing client output for changed source/dependency files — passed, 48 files before the fix:

node --input-type=module -e "import { execFileSync } from 'node:child_process'; import { applyIncrementalClientChanges } from './build/next/transpile.ts'; const files = execFileSync('git', ['diff', '--name-only', 'ba69f50579d306e24b01564a7aa4cd6a086145cd', '--', 'src'], { encoding: 'utf8' }).trim().split('\n').filter(Boolean); await applyIncrementalClientChanges(process.cwd(), 'out', files); console.log('Refreshed client output for ' + files.length + ' files.');"

Compile the final model correction — passed:

node --input-type=module -e "import { applyIncrementalClientChanges } from './build/next/transpile.ts'; await applyIncrementalClientChanges(process.cwd(), 'out', ['src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.ts']);"

Focused regression suites — 656 passed, 13 pre-existing skipped:

npm run test-browser-no-install -- \
  --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionViewModel.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionsOpener.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/chatSessions/chatSessionsService.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/plugins/pluginUrlHandler.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/editorCloudSandboxContribution.test.ts \
  --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxTelemetry.test.ts \
  --run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/cloudSandboxAgentHostContribution.test.ts \
  --browser chromium --reporter dot

Changed-file ESLint — passed:

npm run eslint -- \
  src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.ts \
  src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionViewModel.test.ts

Client type-check — failed with only the two unchanged SDK baseline errors documented above:

npm run typecheck-client

Patch whitespace validation — passed before committing:

git diff --cached --check

A queued resolution can consume a later manual refresh before that caller's debounce expires. Keep refresh intent and errors in the same batch so callers observe the right failure even when a later request replaces their delayed task. Do not execute an already consumed batch again.

Add regressions for overlapping queues, a later successful refresh, and exactly-once error delivery to coalesced callers. Follow-up to #345710 and the review on #345711; related #345234.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 03:35

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.

🟢 Approval recommended

No active review issues are reported for the coalesced chat session refresh error-propagation change.

No open issues 🎉

What changed in this PR

This follow-up to #345710 fixes error propagation in coalesced chat session refreshes, so callers retain failures from their batch even when another queued task executes it or a later refresh succeeds.

Changes:

  • Keep refresh intent, lazy-item resolution, and errors together in a provider batch, preventing duplicate execution.
  • Add three regression cases covering overlapping refreshes and error delivery to each coalesced caller.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentSessionViewModel.test.ts Adds overlap and per-caller error-propagation regressions.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentSessionsModel.ts Preserves batch errors across delayed and queued refresh tasks.

Review effort: Balanced

@osortega
Osvaldo Ortega (osortega) marked this pull request as ready for review November 3, 2026 03:45
@osortega
Osvaldo Ortega (osortega) merged commit e4c97df into main Nov 3, 2026
56 checks passed
@osortega
Osvaldo Ortega (osortega) deleted the osortega/agents/session-refresh-errors branch November 3, 2026 04:12
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 3, 2026
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.

3 participants