Skip to content

agentHost: poll for the mirror retry instead of sleeping in an AgentService test - #342246

Merged
Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/test-perf-agent-service-mirror-retry
Oct 17, 2026
Merged

Alexandru Dima (alexdima) merged 1 commit into
mainfrom
agents/test-perf-agent-service-mirror-retry

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

cc Sandeep Somavarapu (@sandy081) Benjamin Christopher Simmonds (@benibenj)


The test slept a fixed 500ms waiting for the background retry of a failed mirror write. Poll the database for the retried write instead. whenIdle() is not used because it would flush the record itself and mask a broken retry.

Runs in both the Electron and node unit test runs: ~540ms drops to ~30ms.

Part of a series that speeds up unit tests waiting on real time, found from the slow tests in the Linux Electron unit test job. Each change is a separate PR so it can be reverted on its own. Test files only; no assertions changed.

How to test

npm run build-fast -- --client-only
./scripts/test.sh --run src/vs/platform/agentHost/test/node/agentService.test.ts
npm run test-node -- --run src/vs/platform/agentHost/test/node/agentService.test.ts

Results on macOS, with only this commit applied on top of 832a728:

  • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/agentService.test.ts: 1122 passing (35s), 16 pending
  • npm run test-node -- --run src/vs/platform/agentHost/test/node/agentService.test.ts: 1121 passing (42s), 16 pending, 1 failing

The single node failure was a different test, "a chat's movability follows the events of the services that hold its session's state…", which this change does not touch. It did not reproduce in 10 later runs of this branch or in 15 runs of the unmodified base, so it looks like a pre-existing flaky test; it is being investigated separately.

…ervice test

The test slept a fixed 500ms waiting for the background retry of a failed mirror write. Poll the
database for the retried write instead. `whenIdle()` is not used because it would flush the record itself
and mask a broken retry.

Runs in both the Electron and node unit test runs: ~540ms drops to ~30ms.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 08:53

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

The focused test-only change preserves retry failure detection, with no unresolved findings.

No open issues 🎉

What changed in this PR

Speeds up an AgentService retry test by waiting for persisted metadata instead of a fixed delay.

Changes:

  • Replaces the 500 ms sleep with bounded polling using retry.
  • Preserves existing checks without explicitly flushing pending writes.
File Description
src/​vs/​platform/​agentHost/​test/​node/​agentService.test.ts Imports retry and polls for the background mirror write.

Review effort: Balanced

@alexdima
Alexandru Dima (alexdima) merged commit d21d951 into main Oct 17, 2026
84 of 85 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the agents/test-perf-agent-service-mirror-retry branch October 17, 2026 15:35
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 17, 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.

3 participants