fix: await async getService in all dispatcher handlers#814
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rvice tests - Make getService() and getObjectQLService() async to properly await Promise-based service factories - Add await to all callers: handleAuth, handleAnalytics, handleStorage, handleAutomation, handlePackages - Add await to all kernel.context.getService() calls in handleMetadata and handleUi - Add 20 new tests covering async/sync/missing service scenarios Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix async issues in getService and handleAnalytics
fix: await async getService in all dispatcher handlers
Feb 25, 2026
hotlong
marked this pull request as ready for review
February 25, 2026 08:15
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where HttpDispatcher handlers were calling getService() synchronously when it could return a Promise from async factory-based service registration, causing runtime errors like "Service 'analytics' is async - use await".
Changes:
- Made
getService()andgetObjectQLService()async methods in HttpDispatcher - Updated all 13 call sites across 7 handlers to properly await service resolution: handleAnalytics, handleAuth, handleStorage, handleAutomation, handleMetadata (5 call sites), handleUi, and handlePackages
- Added 20 comprehensive tests covering Promise-based service injection, synchronous backward compatibility, missing services, and error propagation scenarios
- Updated ROADMAP.md to document the fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/runtime/src/http-dispatcher.ts | Made getService() and getObjectQLService() async; updated all 13 call sites to await these methods across handleAnalytics, handleAuth, handleMetadata (5 sites), handleStorage, handleUi, and handleAutomation handlers |
| packages/runtime/src/http-dispatcher.test.ts | Added 20 new tests organized in 3 test suites: async service resolution (Promise-based injection), synchronous backward compatibility, and service method error handling |
| ROADMAP.md | Added entry documenting the dispatcher async getService bug fix with coverage details |
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.
getService()can return a Promise when services are registered via async factories, but no call site awaited it — causing runtime errors likeService 'analytics' is async - use await.Changes
getService()/getObjectQLService()→asyncwithawaitonkernel.getService()andkernel.context.getService()await:handleAnalytics,handleAuth,handleStorage,handleAutomation,handlePackages,handleMetadata(5 sites),handleUiBefore:
After:
Runtime: 49/49 tests pass. Spec: 6507/6507 unchanged.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.