Repository navigation
agentHost: park sessions whose provider cannot vouch for them until its catalog becomes readable - #342127
Merged
Sandeep Somavarapu (sandy081) merged 3 commits intoOct 16, 2026
Conversation
…ts catalog becomes readable Reconciliation parked `sourceUnresolvable` sessions but retried `providerUnavailable` ones on every pass. A registered provider whose catalog is unreadable (older codex sessions in production) therefore had each session's database opened on every 30 s pass, indefinitely: about 10 re-attempts per session per hour before Block 4a and about 80 after it. - `providerUnavailable` now parks the session like `sourceUnresolvable`, both when the provider is unregistered (checked before any storage is claimed) and when a registered provider cannot vouch for it. Parked sessions remember their provider. - When a provider's catalog becomes readable, `wakeParkedProviderSessions` releases only that provider's parked sessions and a pass is scheduled if any were released. That pass re-projects them and converts their legacy chat catalogs. Provider registration, session mutations and the hourly verification still wake parked sessions as before. - A wake generation keeps a pass from parking a session whose source it resolved before a wake, matching the existing dirty-marker guard. - Parking and every wake, including the per-provider one, are announced through `onDidChangeParkedSessions`, so chat movability (#342047), which treats a parked legacy catalog as unverifiable, stays current. - AGENTS.md describes the two parking reasons and their wake signals. Measured with 110 such sessions and passes every 30 s: 6,000 session database opens in an hour before, 110 after (each session's re-projection parks it once), then only the hourly verification's sample. End to end with 70 sessions: 150 opens every pass before; 150 and 60 in the first two passes after, then 0. All 70 convert once the catalog becomes readable. Co-authored-by: Copilot <[email protected]>
Contributor
roblourens
previously approved these changes
Oct 16, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Successfully restored legacy sessions can remain parked, blocking conversion and chat moves until another wake signal.
1 open finding
What changed in this PR
Reduces repeated Agent Host database reads by parking sessions whose provider cannot verify them, extending the earlier chat-catalog retry fix.
Changes:
- Parks provider-unavailable sessions and adds provider-specific wakeups.
- Guards against parking after a concurrent wake and emits parking-change notifications.
- Adds regression coverage and documents wake behavior.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests parking, wakeup, and conversion together. |
src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts |
Tests retry suppression, provider-specific wakes, races, and events. |
src/vs/platform/agentHost/node/agentService.ts |
Wakes parked sessions when their provider catalog becomes readable. |
src/vs/platform/agentHost/node/agentHostCatalogReconciliationService.ts |
Implements provider-aware parking and wake-generation checks. |
src/vs/platform/agentHost/AGENTS.md |
Documents parking reasons and wake signals. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…lookup A legacy session parked as `providerUnavailable` can restore through its provider's per-session lookup (`activation: 'restore'`) while the provider's whole catalog stays unreadable. Codex, for example, answers a restore but returns nothing to passive lookups until it is activated. That restore neither made the catalog readable nor woke the session, so the session stayed excluded from reconciliation. `_normalizeCatalogForMove` then refused its chats as `legacyCatalog` until another wake, possibly the hourly verification. A successful restore is evidence that the session's source resolves, so it now releases that session's parking and schedules a pass. Once loaded, the session re-projects from its live state and converts. Addresses review feedback on #342127. Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
dismissed
roblourens’s stale review
via
October 16, 2026 21:56
4c7fff4
…unavailable-sessions
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 16, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/park-provider-unavailable-sessions
branch
October 16, 2026 22:38
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.

Follow-up to #342077, as a separate PR. There is no separate issue; it was found while investigating today's Insiders agent host logs.
Problem
Catalog reconciliation already parks
sourceUnresolvablesessions, but it retriedproviderUnavailablesessions on every pass. If a provider is registered but its catalog is unreadable, reconciliation opened each of its sessions' databases on every 30 s pass, indefinitely. In today's logs, the 69 oldercodexsessions in that state were re-attempted about 10 times per session per hour before Block 4a and about 80 times after it. This predates 4a, and #342077 left it in place.Fix
providerUnavailablenow parks a session likesourceUnresolvable. This applies both when the provider is unregistered (checked before any storage is opened) and when a registered provider can't vouch for the session. Parked sessions remember their provider.wakeParkedProviderSessionsreleases only that provider's parked sessions, and schedules a pass only if any were released. That pass re-projects them and converts their legacy chat catalogs. Provider registration, session mutations and the hourly verification still wake parked sessions as before.onDidChangeParkedSessions. Chat movability treats a parked legacy catalog as unverifiable, so it stays current. A loaded session never resolvesproviderUnavailable(its live summary supplies the metadata), so this doesn't block moves of open sessions.Measurement (passes every 30 s)
Tests
AgentServicewith the real database: 70 sessions are parked, then woken and converted when the catalog becomes readable.providerUnavailablebeing retried every pass now use a failing source. The chat-move tests from agentHost: harden chat moves (refusals, strict movable, session moves, Copilot storage, new sessions) #342047 call the new_parksignature.providerUnavailable.Validation
npm run transpile-client: passed.npm run test-node -- --run …/agentService.test.ts --run …/agentHostCatalogReconciliationService.test.ts --run …/agentHostChatCatalogMigration.test.ts --run …/agentHostChatMovability.test.ts: 1159 passing, 0 failing.npm run test-node -- --runGlob "**/vs/platform/agentHost/test/node/**/*.test.js": 11688 passing, 14 failing. All 14 areCopilotAgentenvironment failures; the same 14 fail on unmodified main.npm run typecheck-client: 2 errors, both incopilotSdkManagedSettings.integrationTest.ts(ensembleTier). That file is untouched here, and the same 2 errors occur on unmodifiedorigin/main. This change adds none.npm run eslint -- <changed .ts files>: passed.npm run precommit, also run by the commit hook): passed.npm run build-fastwas not run; dependency install hits an npm E401, and credentials were not changed.