Repository navigation
Preserve sandbox history when live hydration fails - #340815
Merged
Osvaldo Ortega (osortega) merged 3 commits intoOct 14, 2026
Merged
Conversation
Distinguish failed live history from authoritative snapshots so recorded messages, cached history, and recovery remain available. Keep lazy session initialization conditional on a successful empty recorded read. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A truncated recorded response can still be mistaken for authoritative empty history, allowing unsafe session initialization.
1 open finding
What changed in this PR
Preserves recorded cloud sandbox transcripts when live Agent Host hydration fails.
Changes:
- Exposes explicit initial-history failures.
- Rejects failed live promotion while retaining recovery state.
- Adds real-provider regression coverage.
| File | Description |
|---|---|
chatSessionsService.ts |
Defines the history-load failure result. |
agentHostSessionHandler.ts |
Reports hydration failures and releases subscriptions. |
cloudSandboxSessionHandler.ts |
Validates live snapshots before promotion. |
agentHostChatContribution.test.ts |
Covers promotion, retry, and cancellation paths. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Connor Peet (connor4312)
previously approved these changes
Oct 9, 2026
Connor Peet (connor4312)
left a comment
Member
There was a problem hiding this comment.
Reviewed the full diff and relevant session hydration, history fallback, and subscription cleanup context. No actionable P1 or P2 security or correctness findings.
Written by Connor's agent running GPT-6.1 Sol
Aaron Munger (amunger)
previously approved these changes
Oct 9, 2026
Co-authored-by: osortega <[email protected]>
Copilot
AI
dismissed stale reviews from Aaron Munger (amunger) and Connor Peet (connor4312)
via
October 14, 2026 01:13
90fef0a
roblourens
approved these changes
Oct 14, 2026
Contributor
Ross Wollman (rwoll)
approved these changes
Oct 14, 2026
Osvaldo Ortega (osortega)
deleted the
copilot/sandbox-live-hydration-recovery
branch
October 14, 2026 03:46
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.

Summary
Follow-up to #340354, addressing the live-hydration review finding. No separate tracking issue was supplied.
AgentHostSessionHandlercan fulfill its content request with an error transcript or an empty root-session fallback after a subscription failure. The sandbox facade previously treated either result as a successful live snapshot, replacing recorded messages, invalidating their cache, cancelling the recorded refresh, and disabling its recovery paths.No new setting, protocol field, storage key, telemetry event, or banner is introduced. Recorded-history recovery still does not reconnect or submit input.
Validation
Truncated-root follow-up (
d9b11a29af2), using Node 24.18.0:npm run build-fast -- --client-only— passed.node build/hygiene.ts src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts— passed.npm run eslint -- src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts— passed.git diff --check— passed.xvfb-run -a ./scripts/test.sh --no-sandbox --disable-dev-shm-usage --reporter dot \ --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \ --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxSessionHandler.test.ts \ --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxHistoryCache.test.ts \ --grep 'history loading cloud sandbox promotion|CloudSandboxSessionHandler|CloudSandboxHistoryCache'Initial fix (
e5ac639c4b8), using Node 24.18.0:npm run install-fast— passed after the new main branch's SDK/runtime version check identified stale dependencies. No dependency manifests changed.npm run build-fast -- --client-only— passed.npm run typecheck-client— passed, including the final cancellation/subscription-release assertions.node build/hygiene.ts src/vs/workbench/contrib/chat/common/chatSessionsService.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts— passed. After adding cancellation/subscription-release coverage,node build/hygiene.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.tsalso passed.npm run eslint -- src/vs/workbench/contrib/chat/common/chatSessionsService.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts— passed, all four changed files.git diff --check— passed.The following focused selection passed 130 tests, including 12 real-provider sandbox promotion cases:
xvfb-run -a ./scripts/test.sh --no-sandbox --disable-dev-shm-usage --reporter dot \ --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \ --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxSessionHandler.test.ts \ --run src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxHistoryCache.test.ts \ --grep 'history loading|history with tool events|disposal|does not render a load failure|still renders a load failure|CloudSandboxSessionHandler|CloudSandboxHistoryCache'The real-provider regression cases reproduced eight failures on the unfixed implementation, including cache invalidation, transcript replacement, cancelled recorded reads, and lost retry. One intermediate Electron launch crashed during module loading (exit code 5), before executing tests; the final identical selection completed successfully.
Live cloud end-to-end flows were not exercised.
How to Test