-
-
Notifications
You must be signed in to change notification settings - Fork 396
Fix 404 error on /api/context/inject during worker startup #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ject route Co-authored-by: thedotmack <[email protected]>
Co-authored-by: thedotmack <[email protected]>
Co-authored-by: thedotmack <[email protected]>
Co-authored-by: thedotmack <[email protected]>
Compiled worker service and MCP server with the initialization race condition fix. Validation results: All tests passing, route available immediately on restart. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
PR Review: Fix 404 error on /api/context/inject during worker startupSummaryThis PR addresses a critical race condition where the Code Quality & Architecture ✅Strong Points:
Design Pattern Analysis: this.initializationComplete = new Promise((resolve) => {
this.resolveInitialization = resolve;
});This is idiomatic and clear. Potential Issues & Concerns1. Code Duplication (Medium Priority)
|
The context hook fails with
Cannot GET /api/context/injecton fresh installs and restarts because the route is registered after database initialization completes, creating a race condition.Changes
Worker service initialization
initializationCompletePromise to track async background initialization/api/context/injectroute immediately insetupRoutes()instead of after DB initinitializeBackground()when SearchRoutes are readyImplementation
The route handler duplicates logic from
SearchRoutes.handleContextInjectby design—the route must exist before SearchRoutes initializes to prevent 404s.Test coverage
Original prompt
This section details on the original issue you should resolve
<issue_title>Error: Context generation failed: Worker service connection failed.</issue_title>
<issue_description>Describe the bug
Plugin always starts with error about worker service connection failed.
To Reproduce
Steps to reproduce the behavior:
/plugin marketplace add thedotmack/claude-memthenplugin install claude-memExpected behavior
I am expecting that the plugin works after installing and reopening Claude Code. I am also expecting that following the instructions from the error fixes the issue.
Instructions from the error:
Desktop (please complete the following information):
Full Claude output: