fix(server): wait for web search plugin activation - #46916
Open
Hona wants to merge 1 commit into
Open
Conversation
Hona
commented
Sep 2, 2026
Member
- Wait for Location plugin activation before listing web-search providers or running queries, including debounced reloads. Keep registration asynchronous and plugin-internal reads non-blocking.
- Cover immediate requests during startup and reload with an explicit activation gate, without sleeps or retries.
- Correct the SDK subscriber-abort assertion to expect clean iterator completion. Host-close and source-failure behavior is unchanged.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The updated Promise subscription-abort test expectation doesn’t match the current embedded fetch/SSE implementation, which surfaces abort as a transport error.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR ensures web search routes don’t observe an empty/partial plugin-backed provider registry during Location startup or plugin reload by gating provider listing and queries on plugin activation, and updates SDK tests to reflect the intended subscription abort semantics.
Changes:
- Gate
websearch.providersandwebsearch.queryhandlers onPlugin.awaitActivationto avoid reading plugin-provided state before activation settles. - Add an embedded test that asserts web search calls block until plugin activation completes during both startup and reload scenarios.
- Update the Promise SDK event-subscription abort test expectation.
File summaries
| File | Description |
|---|---|
| packages/server/src/handlers/websearch.ts | Adds an activation gate before listing providers and running web search queries. |
| packages/sdk/test/promise.test.ts | Changes the expected behavior when aborting a Promise event subscription. |
| packages/sdk/test/embedded.test.ts | Adds coverage ensuring web search waits for plugin activation during startup and reload. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
45
to
+47
| const pending = events.next() | ||
| controller.abort() | ||
| const error = await pending.catch((error: unknown) => error) | ||
| expect(error).toMatchObject({ name: "ClientError", reason: "Transport" }) | ||
| expect(await pending).toEqual({ done: true, value: undefined }) |
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.