fix(worker): Auto-restart worker on version mismatch (#484)
When the plugin updates but the worker was already running on the old version, hooks would fail with 400 errors because the new hook scripts tried to call APIs that don't exist in the old worker. Changes: - /api/version now returns BUILT_IN_VERSION (compiled at build time) instead of reading from disk at runtime - worker-service start command now checks for version mismatch and auto-restarts if the running worker version differs from plugin version - Downgraded hook version mismatch warning to debug logging (now handled by auto-restart) Fixes #484 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,17 +92,19 @@ async function getWorkerVersion(): Promise<string> {
|
||||
|
||||
/**
|
||||
* Check if worker version matches plugin version
|
||||
* Logs a warning if mismatch is detected
|
||||
* Note: Auto-restart on version mismatch is now handled in worker-service.ts start command (issue #484)
|
||||
* This function logs for informational purposes only
|
||||
*/
|
||||
async function checkWorkerVersion(): Promise<void> {
|
||||
const pluginVersion = getPluginVersion();
|
||||
const workerVersion = await getWorkerVersion();
|
||||
|
||||
if (pluginVersion !== workerVersion) {
|
||||
logger.warn('SYSTEM', 'Worker version mismatch', {
|
||||
// Just log debug info - auto-restart handles the mismatch in worker-service.ts
|
||||
logger.debug('SYSTEM', 'Version check', {
|
||||
pluginVersion,
|
||||
workerVersion,
|
||||
hint: 'Restart worker with: claude-mem worker restart'
|
||||
note: 'Mismatch will be auto-restarted by worker-service start command'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user