diff --git a/src/cli/commands/assistants/chat/index.ts b/src/cli/commands/assistants/chat/index.ts index f28748f12..20a07ff92 100644 --- a/src/cli/commands/assistants/chat/index.ts +++ b/src/cli/commands/assistants/chat/index.ts @@ -419,6 +419,21 @@ async function handleChatError(error: unknown, config: ProviderProfile): Promise const context = createErrorContext(error); logger.error('Assistant chat API call failed', context); + // Log the actual error details for debugging (instead of [object Object]) + if (error instanceof Error) { + logger.error('Assistant chat error details', { + message: error.message, + name: error.name, + code: (error as any).code, + stack: error.stack + }); + } else { + logger.error('Assistant chat error details (non-Error)', { + error: String(error), + type: typeof error + }); + } + if (error instanceof Error && (error.message.includes('401') || error.message.includes('403'))) { await promptReauthentication(config); } diff --git a/src/migrations/__tests__/migration-runner-ordering.test.ts b/src/migrations/__tests__/migration-runner-ordering.test.ts index 2c8b3af4c..9176bd1dd 100644 --- a/src/migrations/__tests__/migration-runner-ordering.test.ts +++ b/src/migrations/__tests__/migration-runner-ordering.test.ts @@ -85,7 +85,14 @@ afterEach(async () => { openLoggers = []; if (originalCodemieHome !== undefined) process.env.CODEMIE_HOME = originalCodemieHome; else delete process.env.CODEMIE_HOME; - rmSync(tmpHome, { recursive: true, force: true }); + // Windows can still hold log file handles briefly after stream.end(); force + + // maxRetries only suppress ENOENT, so treat residual ENOTEMPTY/EBUSY as + // best-effort teardown (matches claude.metrics-processor-names.test.ts). + try { + rmSync(tmpHome, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); + } catch { + /* ignore temp-dir cleanup races */ + } vi.restoreAllMocks(); });