chore: bump version to 7.1.2
🐛 Bug Fixes **Windows Installation** - Fixed Bun PATH detection on Windows after fresh install - Added fallback to check common install paths before PATH reload - Improved smart-install.js to use full Bun path when not in PATH - Added proper path quoting for Windows usernames with spaces **Worker Startup** - Fixed worker connection failures in Stop hook - Added health check retry loop (5 attempts, 500ms intervals) - Worker now waits up to 2.5s for responsiveness before returning - Improved error detection for Bun's ConnectionRefused error format 🎯 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
*/
|
||||
export function handleWorkerError(error: any): never {
|
||||
if (error.cause?.code === 'ECONNREFUSED' ||
|
||||
error.code === 'ConnectionRefused' || // Bun-specific error format
|
||||
error.name === 'TimeoutError' ||
|
||||
error.message?.includes('fetch failed')) {
|
||||
error.message?.includes('fetch failed') ||
|
||||
error.message?.includes('Unable to connect')) {
|
||||
throw new Error(
|
||||
"There's a problem with the worker. Try: npm run worker:restart"
|
||||
);
|
||||
|
||||
@@ -194,13 +194,6 @@ export async function ensureWorkerRunning(): Promise<void> {
|
||||
// Try to start the worker
|
||||
const started = await startWorker();
|
||||
|
||||
// Final health check before throwing error
|
||||
// Worker might be already running but was temporarily unresponsive
|
||||
if (!started && await isWorkerHealthy()) {
|
||||
await ensureWorkerVersionMatches();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!started) {
|
||||
const port = getWorkerPort();
|
||||
throw new Error(
|
||||
@@ -209,4 +202,22 @@ export async function ensureWorkerRunning(): Promise<void> {
|
||||
`If already running, try: npm run worker:restart`
|
||||
);
|
||||
}
|
||||
|
||||
// Wait for worker to become responsive after starting
|
||||
// Try up to 5 times with 500ms delays (2.5 seconds total)
|
||||
for (let i = 0; i < 5; i++) {
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
if (await isWorkerHealthy()) {
|
||||
await ensureWorkerVersionMatches();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Worker started but isn't responding
|
||||
const port = getWorkerPort();
|
||||
logger.error('SYSTEM', 'Worker started but not responding to health checks');
|
||||
throw new Error(
|
||||
`Worker service started but is not responding on port ${port}.\n\n` +
|
||||
`Try: npm run worker:restart`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user