Repository navigation
agentHost: make archived chat workspace tests wait for queued updates - #341882
Merged
Sandeep Somavarapu (sandy081) merged 1 commit intoOct 15, 2026
Merged
Sandeep Somavarapu (sandy081) merged 1 commit into
Sandeep Somavarapu (sandy081) merged 1 commit into
Conversation
Archiving or unarchiving a peer chat updates the session workspace asynchronously, one update at a time per session, and each update persists the session's folders before the next starts. The tests from #341782 slept 10ms instead of waiting for these updates, so when persisting the detached worktree took longer, as on Windows CI, the unarchive had not attached it back yet. Wait for the queued updates instead, and hold the archive's persistence while unarchiving so the worktree test covers the slow case deterministically. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes preserve existing assertions and address timing sensitivity, with no actionable issues identified.
0 open findings
What changed in this PR
Makes Agent Host archive/unarchive workspace tests deterministic without changing production behavior.
Changes:
- Replaces fixed delays with a per-session queue barrier.
- Simulates slow persistence to verify queued unarchive ordering.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts |
Adds a helper that waits for queued workspace updates. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Uses the barrier and adds controlled persistence blocking. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Aaron Munger (amunger)
approved these changes
Oct 15, 2026
Sandeep Somavarapu (sandy081)
deleted the
sandy081/fix-windows-archive-worktree-test
branch
October 15, 2026 23:37
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.
Problem
AgentService (node dispatcher) › additional chat working directories › archiving a peer chat in its own worktree detaches the worktree without deleting itfails intermittently on Windows / Electron-Unit across unrelated PRs (for example #341843 and #341869).The test (added in #341782) checks state after a fixed
await timeout(10). Archiving a chat queues the worktree update on a per-session sequencer: the archive task detaches the worktree right away, then awaits the persistence of the session's working directories, which goes through SQLite. The unarchive task waits behind it. On slower Windows disk I/O, 10 ms isn't enough, so the assertion runs before the unarchive has re-attached the worktree. The CI diff showsafterUnarchivewith the same arrays asafterArchive.The product ordering is correct. This is a test-only fix.
Change
agentServiceTestUtils.ts: addwhenArchivedChatWorkspaceUpdatesSettled(svc, session). It queues a no-op update behind the per-session sequencer, so it resolves only after every queued archive/unarchive update and its persistence.agentService.test.ts: both archive tests (folder and worktree) await that barrier instead oftimeout(10). The worktree test also holds the catalog persistence on purpose, dispatches unarchive while the archive is still persisting, then releases it, so the slow-I/O ordering is checked deterministically.Validation
_persistSessionWorkingDirectoriesreproduced the exact CI diff locally../scripts/test.sh --runGlob "**/agentHost/test/node/**/*.test.js": passed, 11197 passing / 75 pending / 0 failing.npm run typecheck-client: passed.npm run eslint -- <changed files>: passed. Hygiene: passed.