fix(completion): fail closed on backend errors

- silence unexpected completion backend exceptions so TAB completion does not emit stack traces
This commit is contained in:
Tam Nhu Tran
2026-04-03 01:20:50 -04:00
parent e3074ae60e
commit ffe3082528
+7 -3
View File
@@ -254,7 +254,11 @@ function formatForShell(
}
export async function handleCompletionCommand(args: string[]): Promise<void> {
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.
}
}