Repository navigation
agentHost: harden passive session flag persistence across restart - #338970
Merged
Merged
Conversation
Preserve newer local catalog snapshots when applying passive archive/read updates. Replay failed writes after provider shutdown with a shared 250 ms budget, and retain restart logs in CI artifacts. Addresses #338063; the original intermittent Windows failure still needs cross-platform validation. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Teardown-originated failures can still lose their logs because preservation runs only before release().
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Hardens Agent Host passive archive/read flag persistence across restarts and improves failure diagnostics.
Changes:
- Preserves and replays validated pending catalog snapshots during shutdown.
- Adds cancellation, revision, corruption, deletion, and SQLite race coverage.
- Retains Agent Host and Copilot runtime logs for failed E2E tests.
| File | Description |
|---|---|
agentService.ts |
Preserves pending flags and performs bounded shutdown replay. |
agentHostCatalogSyncService.ts |
Adds targeted pending-snapshot replay. |
agentHostCatalogReconciliationService.ts |
Reuses shared replay validation logic. |
agentService.test.ts |
Tests passive updates and shutdown ordering. |
agentHostCatalogSyncService.test.ts |
Tests replay, cancellation, and close races. |
agentHostE2EDiagnostics.ts |
Copies full runtime logs into CI artifacts. |
agentHostE2EDiagnostics.test.ts |
Tests diagnostic log preservation. |
agentHostE2ETestHarness.ts |
Invokes log preservation on test failure. |
e2e/README.md |
Documents retained diagnostic artifacts. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Capture logs on the first resource-cleanup error and again after shutdown, including suite cleanup failures before removing isolated homes. Cover these lifecycle paths with unit tests and replace the platform-dependent ENOTDIR assertion that failed on Windows. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
Contributor
roblourens
marked this pull request as ready for review
October 1, 2026 04:38
roblourens
enabled auto-merge (squash)
October 1, 2026 04:38
TylerLeonhardt
approved these changes
Oct 1, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Addresses #338063.
Changes
Investigation and limitations
Injected catalog-write failures reproduced two concrete problems: a subsequent flag update could overwrite locally pending flags, and cancelling scheduled reconciliation on shutdown could leave the first listing after restart stale. Regression tests failed before the fixes.
The original intermittent Windows failure mechanism is still unconfirmed because the failing jobs did not retain Agent Host logs. Windows/Linux and Azure validation remain outstanding; this draft adds defenses for the demonstrated failure paths and preserves evidence for another CI failure. No E2E assertions were weakened, tests skipped, or existing timeouts raised.
Latest
mainwas merged without rewriting history.Validation
Run locally on macOS against the merged branch:
npm run compile-client- passed, zero compilation errors../scripts/test.sh --run src/vs/platform/agentHost/test/node/agentService.test.ts --run src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts --run src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts --run src/vs/platform/agentHost/test/node/agentHostE2EDiagnostics.test.ts --grep 'AgentHostCatalog|Agent Host E2E diagnostics|shutdown|passive|read/archive toggle|queued.*toggle|archiving.*session|unarchiving.*session'./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/e2e/providers/claudeAgentHostE2E.integrationTest.ts --run src/vs/platform/agentHost/test/node/e2e/providers/copilotAgentHostE2E.integrationTest.ts --run src/vs/platform/agentHost/test/node/e2e/providers/codexAgentHostE2E.integrationTest.ts --grep 'archiving a never-restored session|session metadata history and provider context survive a host restart|peer chat catalog and transcript survive a host restart'(Written by Copilot)