Repository navigation
sessions: Skip local cache entries poisoned by downgrade - #340154
Merged
Merged
Conversation
Reject startup-cache entries that mistook native session URI schemes for agent providers. Rebuild only those local sessions from authoritative host metadata while preserving healthy cache entries and backend identities. Cover filtering, persistence and provider restart. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrowly scoped fix preserves healthy and remote caches and is covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Filters downgrade-poisoned local session-cache entries so authoritative host metadata can rebuild them correctly.
Changes:
- Adds provider-specific cache rejection support.
- Rejects only local
ahp-session/ahp-sessionrecords and marks the cache dirty. - Adds five regression scenarios covering filtering, cleanup, and reconstruction.
| File | Description |
|---|---|
baseAgentHostSessionsProvider.ts |
Supports rejecting cached metadata. |
localAgentHostSessionsProvider.ts |
Filters poisoned local records. |
cloudSandboxSessionsProvider.ts |
Handles the optional cache-adoption result. |
localAgentHostSessionsProvider.test.ts |
Tests filtering and authoritative reconstruction. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Use the IStorageService contract for generic cached-object reads in the new downgrade regression tests. Verified full client type checking, targeted lint, and all 45 cache tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
October 6, 2026 22:35
roblourens
enabled auto-merge (squash)
October 6, 2026 22:35
Ben Villalobos (benvillalobos)
approved these changes
Oct 6, 2026
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
Ignore local startup-cache records whose native
ahp-sessionURI scheme was incorrectly persisted as their agent provider by an older VS Code version.After a downgrade, these records create adapters routed to the unregistered
agent-host-ahp-sessionfrontend type. Upgrading does not fix an already-created adapter when the host subsequently advertises the correct provider.Reject only the known poisoned combination before adapter construction, retain healthy cached records, and rebuild the skipped sessions from authoritative host metadata. Mark the cache dirty so normal saving removes the invalid records. The cache generation and backend session identities remain unchanged.
The rejection is local-provider-only; remote and cloud cache behavior is preserved. This does not make older versions support native session URIs or repair previously saved references to incorrectly routed open panes.
Validation
npm run typecheck-client— passed after correcting the test storage variables to use the genericIStorageServicecontract.npm run build-fast -- --client-only— passed.npm run build-fast— passed, including the extension outputs needed for live validation../scripts/test.sh --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts --run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts --grep 'cache|cached|opaque advertised|mixed resources'— passed, 45 tests.npm run eslint -- src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.ts src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts— passed.git diff --check— passed.Five new regressions cover selective filtering, removal of an entirely poisoned cache while the host is unavailable, and authoritative Copilot/Claude/Codex reconstruction with fresh-provider restart. The first four regressions were run before the implementation and failed.
Live validation
Passed in a real Code OSS 1.142.0 Dev Agents window on macOS, using isolated copies of two actual poisoned cache records, their host databases and Copilot SDK sessions, plus a healthy legacy-session control.
agent-host-copilotclifrontend identity and rendered request/response history.copilotcli.Live evidence was retained locally as screenshots, sampled video and Playwright traces. Previously saved malformed open-pane references were excluded from the fresh validation profile and remain outside this fix's scope. The CI follow-up changes only TypeScript annotations in the tests; production code and live-validation inputs remain unchanged.
(Written by Copilot)