feat(cli): add Ctrl+Y shortcut to retry failed requests#2011
Merged
yiliang114 merged 18 commits intomainfrom Mar 2, 2026
Merged
feat(cli): add Ctrl+Y shortcut to retry failed requests#2011yiliang114 merged 18 commits intomainfrom
yiliang114 merged 18 commits intomainfrom
Conversation
- Add Ctrl+Y keyboard shortcut for retrying the last failed request - Add isNetworkError() to detect transient network failures (ECONNREFUSED, ETIMEDOUT, etc.) - Add DashScope 1305 error code to rate limit detection - Add error hint \"Press Ctrl+Y to retry\" in error messages - Support user-defined error codes for retry via config - Add retryLastPrompt() hook in useGeminiStream - Update keyboard shortcuts documentation
…onfig - Add comprehensive tests for Ctrl+Y retry shortcut in InputPrompt - Add unit tests for retryLastPrompt in useGeminiStream hook - Add detailed JSDoc comments for retryLastPrompt function and Ctrl+Y shortcut - Extend isRateLimitError to support custom error codes via retryErrorCodes config - Fix rate limit retry log variable reference (RATE_LIMIT_RETRY_OPTIONS → maxRateLimitRetries) - Add Eclipse IDE files to .gitignore Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…sages Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> - Modify ErrorMessage component to remove dim color from hint text - Update useGeminiStream hook to improve retry countdown behavior with option to preserve or clear hints - Adjust tests to match new error handling implementation
…retry-keybinding
When a request errors out, the error message shows an inline hint "(Press Ctrl+Y to retry.)" in secondary color. Pressing Ctrl+Y re-submits the same prompt, commits the error text to history (without the hint), and clears the hint from the UI. - Add retryLastPrompt action wired to Ctrl+Y via keyBindings and InputPrompt - Track last submitted prompt and error state in useGeminiStream refs - Show retry hint inline with error text in ErrorMessage component, wrapping naturally on narrow terminals while preserving hint color - Expose retryLastPrompt through UIActionsContext - Add keyboard shortcut entry in KeyboardShortcuts display - Add i18n strings for hint and no-retry-available message - Document Ctrl+Y in keyboard-shortcuts.md
When an auto-retry countdown is active (retryCountdownTimerRef is set),
handleErrorEvent should not overwrite it with the Ctrl+Y hint. The auto-retry
hint ("retrying in Xs...") and manual retry hint ("Press Ctrl+Y to retry.")
are mutually exclusive:
- Auto-retry errors (e.g., rate limits): show countdown hint
- Other errors: show Ctrl+Y hint
Also removed retryErrorCodes from ContentGeneratorConfig as it's not part
of the minimal Ctrl+Y feature scope.
Revert clearRetryCountdown to simplest form without options parameter. The function now just clears the timer and pending item without any automatic history commit logic.
…RetryErrorItem Auto-retry countdown and manual retry hint are now independent: - pendingRetryErrorItem: displays error message with optional hint - pendingRetryCountdownItem: displays separate countdown line for auto-retry This ensures both can be shown simultaneously without overriding each other.
The retry_countdown type should be rendered as a separate message, not inline in ErrorMessage. This allows auto-retry countdown and manual retry hint to coexist properly.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Remove unnecessary period from 'Press Ctrl+Y to retry' translation strings in both en.js and zh.js locales. Also update the corresponding usage in useGeminiStream hook.
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Add .project configuration files for client and qwencode modules to support Eclipse IDE development environment.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This reverts commit da83b5e.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Display a keyboard shortcut hint allowing users to quickly retry

Retrying in progress, Hide the hint once the shortcut is used to avoid encouraging repeated shortcut presses

Overview
Add Ctrl+Y keyboard shortcut to Qwen-Code CLI, allowing users to quickly retry the last failed request for improved user experience.
Key Changes
1. Keyboard Shortcut Support
RETRY_LASTcommand inkeyBindings.ts, bound to Ctrl+YKeyboardShortcuts.tsxcomponent with shortcut handling logickeyboard-shortcuts.md2. Core Retry Logic
useGeminiStream.ts: Implement core retry mechanismlastPromptRefandlastPromptErroredRefto track last failed requestretryLastQuerymethod for retry functionalityskipPreparationoption to skip preparation step on retry3. Error Message Enhancement
ErrorMessage.tsx: Support displaying retry hints in error messages4. Internationalization
retryLastandPress Ctrl+Y to retry.in both English and Chinese5. Type Definitions
types.tsto add optionalhintfield to error message typeUIActionsContext.tsxwith retry-related action types6. Test Coverage
InputPrompt.test.tsx: Add 135+ lines of test code covering retry functionalityAppContainer.test.tsx,Composer.test.tsx, etc.useGeminiStream.test.tsx: Optimize test caseskeyMatchers.test.ts: Add Ctrl+Y keyboard shortcut matching testsTest Plan
Compatibility
Related Issue
Resolves #1908