From ffe3082528779c9fc20822d0a22b4a3753f648fc Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Fri, 3 Apr 2026 01:20:50 -0400 Subject: [PATCH] fix(completion): fail closed on backend errors - silence unexpected completion backend exceptions so TAB completion does not emit stack traces --- src/commands/completion-backend.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/commands/completion-backend.ts b/src/commands/completion-backend.ts index 2537d4c5..04cbdc83 100644 --- a/src/commands/completion-backend.ts +++ b/src/commands/completion-backend.ts @@ -254,7 +254,11 @@ function formatForShell( } export async function handleCompletionCommand(args: string[]): Promise { - const request = parseCompletionArgs(args); - const suggestions = getCompletionSuggestions(request); - process.stdout.write(formatForShell(request.shell, suggestions).join('\n')); + try { + const request = parseCompletionArgs(args); + const suggestions = getCompletionSuggestions(request); + process.stdout.write(formatForShell(request.shell, suggestions).join('\n')); + } catch { + // Completion must fail closed and quietly so shell TAB does not surface stack traces. + } }