From b7396e4f653204ec50b76a51cf89b2477c741d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Sun, 19 Apr 2026 14:12:22 +0800 Subject: [PATCH] Expose raw CLI startup details in desktop error cards so Windows failures are diagnosable The chat UI translated CLI startup failures to a generic localized string and hid the server-provided detail entirely. That made remote Windows debugging guesswork even when the backend had already captured the real stderr payload. This change keeps the localized summary but renders the raw startup detail underneath when it differs, and adds a regression test covering the Git Bash missing case. Constraint: Windows Server repro is happening remotely, so the immediate value is better diagnostics rather than guessing a root cause locally Rejected: Leave the generic translation only | obscures actionable stderr and slows every remote repro cycle Confidence: high Scope-risk: narrow Reversibility: clean Directive: For translated startup errors, preserve backend detail somewhere visible unless it duplicates the summary Tested: cd desktop && bunx vitest run src/components/chat/MessageList.test.tsx Tested: cd desktop && bun run lint Not-tested: Full desktop interaction flow on Windows Server 2022 Related: GitHub issue #62 --- .../src/components/chat/MessageList.test.tsx | 28 +++++++++++++++++++ desktop/src/components/chat/MessageList.tsx | 9 ++++++ 2 files changed, 37 insertions(+) diff --git a/desktop/src/components/chat/MessageList.test.tsx b/desktop/src/components/chat/MessageList.test.tsx index 603ee9a2..ca1e83d2 100644 --- a/desktop/src/components/chat/MessageList.test.tsx +++ b/desktop/src/components/chat/MessageList.test.tsx @@ -281,4 +281,32 @@ describe('MessageList nested tool calls', () => { '先看 CLI 和服务端入口。\n再看 desktop 前后端边界。' ) }) + + it('shows raw startup details under translated CLI startup errors', () => { + useChatStore.setState({ + sessions: { + [ACTIVE_TAB]: makeSessionState({ + messages: [ + { + id: 'error-1', + type: 'error', + code: 'CLI_START_FAILED', + message: + 'CLI exited during startup (code 1): Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win).', + timestamp: 1, + }, + ], + }), + }, + }) + + render() + + expect(screen.getByText('Failed to start CLI process.')).toBeTruthy() + expect( + screen.getByText( + 'CLI exited during startup (code 1): Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win).', + ), + ).toBeTruthy() + }) }) diff --git a/desktop/src/components/chat/MessageList.tsx b/desktop/src/components/chat/MessageList.tsx index 4ee13c6b..a50286ea 100644 --- a/desktop/src/components/chat/MessageList.tsx +++ b/desktop/src/components/chat/MessageList.tsx @@ -222,9 +222,18 @@ export const MessageBlock = memo(function MessageBlock({ const errorKey = message.code ? `error.${message.code}` as TranslationKey : null const errorText = errorKey ? t(errorKey) : null const displayMessage = (errorText && errorText !== errorKey) ? errorText : message.message + const showRawDetail = + Boolean(message.message) && + message.message.trim() !== '' && + message.message !== displayMessage return (
Error: {displayMessage} + {showRawDetail && ( +
+ {message.message} +
+ )}
) }