Skip to content

agentHost: wait for parsed plugin children instead of sleeping 50 ms - #348409

Draft
Bryan Chen (bryanchen-d) wants to merge 1 commit into
mainfrom
flake-fixer/customization-children-wait
Draft

Bryan Chen (bryanchen-d) wants to merge 1 commit into
mainfrom
flake-fixer/customization-children-wait

Conversation

@bryanchen-d

Copy link
Copy Markdown
Collaborator

Main CI 497216 failed on Windows x64 Electron unit with one test:

CopilotAgent › createChat activeClient eager-claim › setClientCustomizations publishes parsed agents in SessionCustomizationUpdated
AssertionError: expected SessionCustomizationUpdated to carry parsed children

Cause

After setting the active client's customizations, the test slept a fixed setTimeout(50) "for the deferred resolution chain in PluginController.sync" and then asserted. That chain parses agents/helper.md from a real temp folder through TestDiskFileSystemProvider, so on a slow or loaded agent the parsed update arrives after 50 ms and the assertion runs too early. The commit in range (#348151) doesn't touch the agent host.

Change

Test-only. Wait for the SessionCustomizationUpdated action that carries parsed children, using the same Event.toPromise(Event.filter(agent.onDidChatProgress, …)) pattern as other tests in this file. The promise is created before the customizations are set, so the action can't be missed. Exactly one such update is published (checked with a temporary 1 s probe), so the assertions still see the same final state.

Validation

  • Ran the test 20 times while 64 busy-loop processes saturated all 32 cores: 0/20 pass on main (all on carry parsed children), 20/20 pass with this change.
  • Unloaded: passes in about 100 ms, as before.
  • The full copilotAgent.test.ts run gives the same pass/fail counts with and without the change. The local failures come from a missing vscode-sqlite3 native build in my borrowed install.
  • tsc --project src/tsconfig.json --noEmit reports no errors in this file.

Authored with Copilot

The CopilotAgent setClientCustomizations test slept 50 ms for PluginController.sync to parse agent files from a real temp folder, then asserted. On a loaded Windows agent the parse took longer (main CI 497216). Wait for the SessionCustomizationUpdated action that carries the parsed children instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 15, 2026 16:47

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 for the test-only change replacing a fixed delay with an event-based wait.

No open issues 🎉

What changed in this PR

This test-only change removes a timing-dependent wait from the Agent Host customization test, addressing failures on slow or heavily loaded CI machines without changing production behavior.

Changes:

  • Replace the fixed 50 ms delay with an event-based wait for SessionCustomizationUpdated containing parsed children.
  • Register the listener before setting customizations to avoid missing the update, while preserving existing assertions.
File Description
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Wait for parsed plugin children to be published instead of relying on a fixed delay.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants