Repository navigation
chat: avoid redundant editor cloud sandbox discovery - #345710
Merged
Osvaldo Ortega (osortega) merged 1 commit intoNov 3, 2026
Merged
Conversation
Reuse the controller's initial refresh on registration instead of forcing another scan. Carry refresh intent through the sessions model so automatic lifecycle and voice-window refreshes can reuse fresh cloud inventory without throttling user refresh. Preserve coalesced manual refreshes and lazy item resolution, and distinguish startup, automatic, and manual discovery telemetry. Related #345234 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the scoped cloud sandbox discovery changes.
No open issues 🎉
What changed in this PR
This PR reduces redundant editor-triggered cloud sandbox discovery as a scoped follow-up to #345216 and #345234. It preserves explicit user Refresh behavior while leaving task hydration, cache persistence, and feed renewal unchanged.
Changes:
- Reuse the controller’s registration refresh when reading session items, preserving lazy resolution and coalesced refresh requests.
- Distinguish initial, automatic, and manual refreshes so automatic requests use existing freshness controls and manual requests take precedence.
- Add discovery attribution and regression coverage for scan counts, refresh ordering, cancellation, focus, and freshness boundaries.
No actionable findings. Reported validation includes 608 passing Chromium tests; client type-checking remains blocked by two documented baseline SDK errors, and live UI/integration validation was not run.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts |
Forward refresh reasons in the test service. |
src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/editorCloudSandboxContribution.test.ts |
Test discovery reuse, attribution, cancellation, and freshness boundaries. |
src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxTelemetry.test.ts |
Verify distinct discovery trigger attribution. |
src/vs/workbench/contrib/chat/test/browser/chatSessions/chatSessionsService.test.ts |
Verify controller refresh reason dispatch. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionViewModel.test.ts |
Cover registration reuse, lazy resolution, and refresh precedence. |
src/vs/workbench/contrib/chat/common/chatSessionsService.ts |
Define optional internal refresh reasons. |
src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.ts |
Route automatic refreshes through freshness checks. |
src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.ts |
Accept automatic discovery attribution in stale checks. |
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts |
Forward refresh intent and identify registration refreshes. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.ts |
Mark model initialization as automatic. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.ts |
Reuse registration results and preserve queued refresh intent. |
src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.ts |
Mark voice-window polling as automatic. |
src/vs/platform/agentHost/common/cloudSandboxAgentHost.ts |
Add the bounded automatic discovery trigger. |
Review effort: Balanced
Osvaldo Ortega (osortega)
marked this pull request as ready for review
November 3, 2026 01:41
Osvaldo Ortega (osortega)
enabled auto-merge (squash)
November 3, 2026 01:42
Contributor
|
This PR will be automatically cherry-picked to |
Joaquín Ruales (jruales)
approved these changes
Nov 3, 2026
Raymond Zhao (rzhao271)
approved these changes
Nov 3, 2026
Osvaldo Ortega (osortega)
disabled auto-merge
November 3, 2026 02:47
Osvaldo Ortega (osortega)
deleted the
osortega/agents/sandbox-refresh-load
branch
November 3, 2026 02:47
Osvaldo Ortega (osortega)
added a commit
that referenced
this pull request
Nov 3, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #345234; follow-up to #345216. This is a scoped, partial improvement, not a resolution of every discovery-load source.
Summary
Remove two sources of redundant editor-triggered cloud sandbox discovery without throttling explicit user Refresh:
ChatSessionsServicealready starts the controller refresh and waits for it when reading items. The sessions model now reads those items instead of requesting another refresh. Coalesced refresh requests and lazy item resolution are preserved.initial/automatic/manualreason through controller dispatch. Model initialization, availability/workspace/trust changes, and the voice window's three-second refresh loop are automatic. The cloud controller routes only automatic calls through its existing freshness, focus, in-flight coalescing, and backoff rules. Initialization and user Refresh bypass the freshness gate; manual intent wins when requests coalesce.startup, automatic discovery asautomatic, and explicit refresh asmanualin the existing bounded discovery telemetry. No new telemetry event or measurement field, configuration setting, extension-host RPC, or AHP contract is introduced.The regression scenario with initialization plus ten three-second automatic refreshes now performs 1 discovery scan instead of 11. A subsequent explicit Refresh performs a second scan and observes updated session data. This is a controlled test result, not an estimate of production-wide request reduction.
Scope
This draft contains only the two completed editor fixes. Agents-window startup rediscovery and healthy feed-renewal reconciliation remain separate follow-ups. Task-list pagination, task-detail hydration, cache persistence, and feed renewal/reconnect behavior are unchanged.
Validation
Fast-forwarded to
mainatae13a3ba2c63033f8c7ac81c9339433b48cf83d3, verified that the reviewed patch was unchanged, refreshed client output, and reran the focused suites:npm run transpile-client; subsequent changes were compiled with the existing incremental helper. The final refresh below compiled 34 changed source files, including the upstream changes.npm run typecheck-clientreports only the same two SDKkerberosAutherrors observed before these changes. No new diagnostics were introduced:src/vs/platform/agentHost/node/copilot/copilotAgent.ts(4426,5): TS2353,kerberosAuthis not inCopilotClientOptions.src/vs/platform/agentHost/test/node/copilotAgent.test.ts(14139,61): TS2339,kerberosAuthis not inCopilotClientOptions.git diff --cached --checkpassed before committing.The normal build/test bootstrap was blocked by the configured feed returning 404 for the pinned pnpm distribution. Validation used the existing transpiler and browser runner without changing dependency manifests, registry configuration, or authentication. Full integration/smoke suites and live UI validation were not run.
Exact local validation commands and results
Initial client output — passed:
Final incremental client output refresh — passed, 34 source files:
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', '763ca42b86dc21577554c6efd7526903dce082e4', '--', 'src'], { encoding: 'utf8' }).trim().split('\n').filter(Boolean); await applyIncrementalClientChanges(process.cwd(), 'out', files); console.log('Refreshed client output for ' + files.length + ' changed source files.');"Focused regression suites — 608 passed, 13 pre-existing skipped:
Changed-file ESLint — passed:
Client type-check — failed with only the two unchanged SDK baseline errors documented above:
Patch whitespace validation — passed before committing: