From 7a71df31ff1e33d6dba1b731efe6877ec1375546 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 17 Apr 2026 22:28:26 +0000 Subject: [PATCH] Add debug logging to submission flow in InputPrompt --- packages/cli/src/ui/components/InputPrompt.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 2e7fe312a7..f97209ad08 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -375,6 +375,7 @@ export const InputPrompt: React.FC = ({ const handleSubmitAndClear = useCallback( (submittedValue: string) => { + debugLogger.log(`[InputPrompt] handleSubmitAndClear: \${submittedValue}`); let processedValue = submittedValue; if (buffer.pastedContent) { processedValue = expandPastePlaceholders( @@ -425,6 +426,7 @@ export const InputPrompt: React.FC = ({ const handleSubmit = useCallback( (submittedValue: string) => { + debugLogger.log(`[InputPrompt] handleSubmit: \${submittedValue}`); const trimmedMessage = submittedValue.trim(); const isSlash = isSlashCommand(trimmedMessage); @@ -1217,9 +1219,15 @@ export const InputPrompt: React.FC = ({ } if (keyMatchers[Command.SUBMIT](key)) { + debugLogger.log( + `[InputPrompt] Command.SUBMIT matched, buffer.text="${buffer.text}"`, + ); if (buffer.text.trim()) { // Check if a paste operation occurred recently to prevent accidental auto-submission if (recentUnsafePasteTime !== null) { + debugLogger.log( + `[InputPrompt] Command.SUBMIT ignored due to recentUnsafePasteTime`, + ); // Paste occurred recently in a terminal where we don't trust pastes // to be reported correctly so assume this paste was really a // newline that was part of the paste. @@ -1237,8 +1245,15 @@ export const InputPrompt: React.FC = ({ buffer.backspace(); buffer.newline(); } else { + debugLogger.log( + `[InputPrompt] Calling handleSubmit from handleInput`, + ); handleSubmit(buffer.text); } + } else { + debugLogger.log( + `[InputPrompt] Command.SUBMIT ignored because buffer is empty`, + ); } return true; }