Repository navigation
agentHost: stop retrying chat catalog conversions that wait for an impossible re-projection - #342077
Merged
Sandeep Somavarapu (sandy081) merged 2 commits intoOct 16, 2026
Conversation
…possible re-projection Block 4a (#341904) made every legacy chat catalog convert, including older provider-scheme sessions whose provider cannot vouch for them (registered but with an unreadable catalog, or no longer knowing the session). Their aggregate never becomes verified, so every conversion attempt ended `notReady` and fed a loop: - `_migrateChatCatalog` opened the session database (`runMigrationExclusive`) and ran legacy reconciliation before the readiness check, then marked the payload dirty, which superseded in-flight re-projections and woke parked sessions so the reconciliation re-opened them on the next pass. - The conversion batch re-attempted every legacy session each cursor cycle, and `_convertReprojected` treated parked or unverified sessions as ready because `_listDirtySessions` omits parked rows, so the retry limit of five never bounded them. Each attempt also scheduled a follow-up pass. Production (one Insiders profile, ~717 sessions, ~110 affected): ~920 migration operations in two ~5 minute windows, passes every 20-30 s. Conversion now decides readiness from central state first: an unverified or dirty aggregate returns `notReady` without opening session.db, writing or waking anything (its re-projection is already owed). A waiting session is skipped by the conversion batches and owes no follow-up pass; it converts right after a pass re-projects it (`succeeded` or an already-current `skipped`) or once its receipt is verified and clean. The check under the session lock stays authoritative. With 110 unvouchable sessions over twelve 30 s passes: 150 migration operations, 350 session database opens and 100 dirty marks per pass before; 50/50/10 operations in the first three passes (re-projections parking each session once, no conversion opens or writes) and nothing after. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes have regression coverage for retry suppression and recovery, with no unresolved blocking findings.
0 open findings
What changed in this PR
Stops repeated Agent Host chat-catalog conversion attempts while sessions cannot be re-projected, addressing the Block 4a retry regression.
Changes:
- Checks central readiness before opening session databases.
- Suppresses redundant conversion retries and follow-up passes while preserving recovery.
- Adds regression coverage and documents the retry behavior.
No actionable findings remain. Tests were not rerun; validation relies on the reported results.
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/agentService.test.ts | Covers conversion attempts, database opens, and dirty marks. |
| src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts | Covers retry suppression, scheduling, and recovery. |
| src/vs/platform/agentHost/node/agentService.ts | Adds shared central-state readiness checks. |
| src/vs/platform/agentHost/node/agentHostChatCatalogV2.md | Documents waiting and retry behavior. |
| src/vs/platform/agentHost/node/agentHostChatCatalogMigration.ts | Shares the awaiting-reprojection result. |
| src/vs/platform/agentHost/node/agentHostCatalogReconciliationService.ts | Gates retries on readiness and avoids redundant scheduling. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dirk Bäumer (dbaeumer)
approved these changes
Oct 16, 2026
Contributor
Sandeep Somavarapu (sandy081)
deleted the
agents/fix-catalog-conversion-retry-storm
branch
October 16, 2026 17:15
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.
Fixes a production regression from Move Chats Block 4a (#341904). There is no separate issue; it was found in today's Insiders agent host logs.
Root cause
Block 4a C4 removed the
requiresLegacyChatCataloggate, so older provider-scheme sessions (codex:/,copilotcli:/,claude:/) now go through chat catalog conversion. For about 110 of them, the provider can't vouch for the session. Either it is registered with an unreadable catalog (providerUnavailable), or it no longer knows the session (sourceUnresolvable, parked). Their aggregate therefore never becomes verified, and every conversion endsnotReady: the session aggregate is unverified or awaits its re-projection. Each attempt then fed a loop:_migrateChatCatalogranreconcileLegacyandrunMigrationExclusive, which callstryOpenDatabase, beforemigrateChatCatalogV2read the cheap central state.notReady. This bumped the dirty revision, so in-flight re-projections came backsuperseded. It also woke parked sessions, so the reconciliation re-opened them on the next pass.convertAfterReprojection. The conversion batch re-attempted every legacy session on each cursor cycle._convertReprojectedtreated parked and unverified sessions as ready, because_listDirtySessionsomits parked rows. On top of that, every attempt scheduled a follow-up pass at the 30 s floor.Evidence (Insiders e9f10b9, which contains 38f4504; counts only)
codexresolvingproviderUnavailable, pluscopilotcli/claudesessions resolvingsourceUnresolvable.kind=migrationoperations, with 4–6 per session per window. Passes ran every 20–30 s (median gap 22 s). Up to 159 operations per pass, against 50 before 4a.sourceUnresolvablesessions were re-attempted about 8–9 times in 4 hours. Post-4a, 22 of them were re-attempted 3 times in 5 minutes.codexproviderUnavailableretries went from about 10 to about 80 per session per hour.listSessionsmedian went from 151 ms (n=15) to 519 ms during the storm (n=5). This is suggestive only.Fix
agentService._migrateChatCatalog: a new_readChatCatalogConversionReadinessreads onlyreadCatalogSnapshotandgetSessionV2. An unverified or dirty aggregate returnsnotReadywithout opening session.db, writing, or waking anything, because its re-projection is already owed._migrateChatMetadataWriteuses the same helper. The check under the session lock stays authoritative, and catalog-override restores are unchanged._convertReprojected: a waiting session becomes ready only when this pass re-projected it (succeeded, or an already-currentskipped), or when its verified receipt is clean. Parked and unverified sessions now wait without an attempt.convertAfterReprojection: does nothing for a session already waiting, and requests no follow-up pass when called inside a pass.agentHostChatCatalogV2.mddescribes the new behaviour.4a's guarantees are kept: sessions still convert once they can, there are no URI-derived owners, and no optional APIs.
Measurement (110 unvouchable sessions, twelve 30 s passes ≈ 6 min)
kind=migrationoperationsAfter the fix, all remaining operations and opens are the reconciliation parking each session once; conversion opens and writes nothing. In the unit test, once the source resolves again, all 12 sessions convert. Before the fix only 8 of 12 did, because their retry budget was spent while unresolvable.
Remaining, not changed here (pre-existing, needs a decision)
codexsessions whose provider is registered but whose catalog is unreadable resolveproviderUnavailableonly after their session DB is opened. They are never parked, so they are re-attempted on every pass. This predates 4a (about 10 per session per hour on 6756a73). Parking them, with a wake when the provider's catalog becomes readable, would change re-projection retry policy, so it is left as a follow-up.Tests
[2,1,1,1,1,1,1]instead of[2,2,2,2,2,1,1]. The batch no longer re-attempts a session that the same pass's prompt retry already covers. The limit and the fallback to the batch cadence still hold.skippedas re-projected (killed by the existing default-provenance conversion test).Validation
npm run transpile-client: passed.npm run test-node -- --run …/agentService.test.ts --run …/agentHostCatalogReconciliationService.test.ts --run …/agentHostChatCatalogMigration.test.ts: 1134 passing, 0 failing.npm run test-node -- --runGlob "**/vs/platform/agentHost/test/node/**/*.test.js": 11610 passing, 14 failing. All 14 areCopilotAgentenvironment failures, and the same 14 fail on unmodified main.npm run typecheck-client: passed.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.