fix: restore AskUser answers after Ctrl+Z + fg suspend/resume#20881
fix: restore AskUser answers after Ctrl+Z + fg suspend/resume#20881PrafulVRaj wants to merge 4 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the issue of losing in-progress AskUser answers when the CLI is suspended and resumed. By introducing a resumeKey that increments on SIGCONT and using it in the key prop of TextQuestionView and ChoiceQuestionView, the components are correctly remounted, ensuring their internal state is re-initialized with the preserved answers. The use of useEffect for signal handling and useState for the key is a standard and appropriate React pattern for this scenario. The solution is well-implemented and directly resolves the problem described.
5b16770 to
5575c5f
Compare
|
Closing to allow other PR created before this to fix the issue 👍 |
Summary
Fix loss of in-progress AskUser answers when the user suspends gemini-cli with Ctrl+Z and resumes with
fg. Answers typed before suspension are now fully restored on resume.Details
A way for
AskUserDialogto register a function that returns its current answers.AppContainerstores those answers before suspension usingonBeforeSuspend. When the dialog mounts again, it initializes its reducer with the saved answers. New methods were added toUIActionsContext: savedAskUserAnswers, registerAskUserAnswers, unregisterAskUserAnswers.useSuspendnow supports an optionalonBeforeSuspendcallback.It achieves pressing Ctrl+Z no longer resets AskUser dialog inputs, answers are saved before suspend and restored after resume. Dialog still owns its state (no unnecessary global state lifting) and clean separation of concerns using context + refs.
Related Issues
Fixes #20838
How to Validate
Windows:
geminiCLImacOS / Linux:
same as win but some difference
fgto resumePre-Merge Checklist