test(agent): skip InstanceBootstrap in plugin-agent regression test#25737
Merged
kitlangton merged 2 commits intodevfrom May 4, 2026
Merged
test(agent): skip InstanceBootstrap in plugin-agent regression test#25737kitlangton merged 2 commits intodevfrom
kitlangton merged 2 commits intodevfrom
Conversation
The plugin-agent regression test was occasionally hanging for 30s on Windows CI. Root cause is the test going through the full `InstanceLayer.layer` (i.e. `InstanceBootstrap.defaultLayer`), which fork-scopes FileWatcher / LSP / MCP / Snapshot / Vcs / etc. — services with native handles that don't always release within the timeout when the test scope closes on Windows. None of those services are needed to verify "plugin config hook adds an agent and Agent.list reflects it." Move the plugin to a stable repo fixture (test/fixture/agent-plugin.ts) so the test can use `it.instance` with the noop InstanceBootstrap that all other instance-scoped tests use. Manually call `Plugin.Service.init` in the body to drive the only bootstrap step that matters here. Production path exercised is unchanged: plugin load → config hook → agent registration → Agent.list.
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
The plugin-agent regression test occasionally hangs for 30s on Windows CI (saw it during the CI run for #25726). It passes alone and on Linux/macOS reliably; the flake is Windows + combined-suite specific.
Root cause
The test loads through
InstanceLayer.layer(fullInstanceBootstrap.defaultLayer), which fork-scopes:FileWatcher(native@parcel/watcher)LSP(child processes)MCP(child processes / network)Snapshot,Vcs,ShareNext,Format,File,ProjectAll of these have native handles. On Windows, several don't always release within the test scope's close window — the 30s timeout fires before teardown completes. None of them are needed to test "plugin config hook adds an agent → Agent.list reflects it."
The test itself only cares about: plugin load → config hook → agent registration → Agent.list.
Fix
Two structural changes, no production code touched:
test/fixture/agent-plugin.ts) instead of writing it into a per-test tmpdir. Keeps the import path stable across runs, eliminates Windows tmpdir/file-handle interactions during teardown.it.live+InstanceLayer.layertoit.instance(which uses the noopInstanceBootstraplike all other instance-scoped tests in this repo). Manually callPlugin.Service.init()in the body — the only bootstrap step the test actually depends on.Production code path exercised is unchanged: plugin load → config hook → agent registration → Agent.list.
Gotcha discovered
The plugin loader's
getLegacyPlugins(src/plugin/index.ts:80) iterates every module export and throwsTypeErroron any export that isn't a function (or{server: function}). So the test constants that the assertion needs to compare against had to live in a siblingagent-plugin.constants.ts, not the plugin file itself. I added a comment in the fixture pointing this out so the next person doesn't trip on it.Verification
bun run test test/agent/plugin-agent-regression.test.ts): 1/1 ✅bun run test test/agent/): 39/39 ✅bun run typecheck: clean ✅Should resolve the Windows-only flake observed in #25726's CI run.