Skip to content

agentHost: make artifact removal tests deterministic - #344938

Merged
Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/fix-flaky-issue-341003-vscode
Oct 29, 2026
Merged

Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/fix-flaky-issue-341003-vscode

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Fixes #341003.

Summary

The artifact-removal fixture waited for session-state mirrors, but an unflushed summary notification or an in-flight catalog write could still enqueue another mirror write after that wait. Persistence assertions could therefore observe different stages of the same mutation.

  • Use the existing catalog-reconciliation idle barrier before flushing mirrors, both when seeding the fixture and when reading persisted/catalog state.
  • Drain before capturing the multi-store snapshot, rather than capturing central state before awaiting persistence.
  • Explicitly exercise summary flushes while a removal is blocked and after mutations finish, for successful and rejected removals with a concurrent tool addition.
  • Replace waits for the real summary-debounce timer with explicit summary flushes.

This changes only tests: no production behavior, sleeps, retries, or weakened assertions.

Validation

  • npm run transpile-client - passed.
  • Electron unit-test runner below - 20 tests passed; repeated in 25 fresh Electron processes, all 500 tests passed.
  • npm run eslint -- src\vs\platform\agentHost\test\node\sessionArtifactRemoval.test.ts - passed.
  • node build\lib\formatter.ts --verify src\vs\platform\agentHost\test\node\sessionArtifactRemoval.test.ts - passed.
  • git diff --check - passed.
  • npm run build-fast -- --client-only - blocked by the checkout's existing dependency mismatch: declared Copilot runtime 1.0.103-unstable.r40031404408.gba6c003, installed SDK runtime 1.0.102. Client transpilation was run separately and passed.
  • npm run typecheck-client - blocked by an unrelated existing dependency declaration error in src/vs/platform/terminal/node/terminalProcess.ts:603: IPty.setParentWindow is missing. No diagnostics in the changed test.

Tests used the existing local Electron binary, with ELECTRON_RUN_AS_NODE unset:

node -e "const {spawnSync}=require('node:child_process'); const r=spawnSync('C:\\Code\\vscode\\.build\\electron\\Code - OSS.exe',['.\\test\\unit\\electron\\index.js','--run','src\\vs\\platform\\agentHost\\test\\node\\sessionArtifactRemoval.test.ts','--reporter','dot'],{stdio:'inherit'});if(r.error)throw r.error;process.exit(r.status??1);"

Drain debounced catalog writes before flushing and reading session-state mirrors. Explicitly cover summary flushes during removal and after queued mutations, including rejected removals, without relying on the debounce timer.

Fixes #341003.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the artifact-removal test changes.

No open issues 🎉

What changed in this PR

Makes the Agent Host artifact-removal tests deterministic to address #341003, without changing production behavior.

Changes:

  • Drain catalog reconciliation before flushing mirrors and capturing persisted-state snapshots.
  • Cover summary flushes during blocked removals and after mutations, including rejected removals with concurrent additions.
  • Replace summary-debounce timer waits with explicit flushes.
File Description
src/​vs/​platform/​agentHost/​test/​node/​sessionArtifactRemoval.test.ts Stabilizes fixture synchronization and persistence assertions, and expands summary-flush timing coverage.

Review effort: Balanced

@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit ff3d136 into main Oct 29, 2026
56 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/fix-flaky-issue-341003-vscode branch October 29, 2026 10:29
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky Tests

3 participants