fix: expand paste placeholders in TextInput on submit#19946
fix: expand paste placeholders in TextInput on submit#19946jackwotherspoon merged 5 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello @Jefftree, 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 correctly addresses the issue where large pastes in TextInput were being submitted as literal placeholder strings. However, the expansion logic in TextInput.tsx has a potential bug when multiple pastes are present due to placeholder string overlapping. I've suggested a regex-based approach that is more robust and efficient, following patterns already established in the codebase.
jackwotherspoon
left a comment
There was a problem hiding this comment.
I think a small shared helper for the paste expansion will help reduce the tests and make sure things don't drift in the future.
1e62cb7 to
57b71b2
Compare
There was a problem hiding this comment.
Feedback on plan worked great and expanded! 👍
I think we may be missing one spot though. The ask user tool is not expanding the pastes... @Jefftree can you see if there is one more call site that needs to use the new helper function?
The file in question is AskUserDialog.tsx to update.
Found the code path. Same target as #19286, fixed! |
There was a problem hiding this comment.
need to expand here as well
|
Overall LGTM, please fix the tests and the 2 remaining spots we're not expanding the placeholder. |
|
Fixed.
|
|
Looks like there may be a related test failure to take a look at @Jefftree |
Done. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…19946) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…19946) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…19946) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…19946) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…19946) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Summary
Fixes large pastes in
TextInput(used by action-required dialogs like "suggest changes") being submitted as literal placeholder strings (e.g.[Pasted Text: 9 lines]) instead of the actual pasted content.Details
When a paste exceeds 5 lines or 500 chars, gemini-cli stores the real content in
buffer.pastedContentand shows a compact placeholder in the input.InputPromptalready expanded these placeholders before submit, butTextInputwas callingonSubmit(text)directly, sending the raw placeholder string to the model.The fix expands placeholders in
TextInput.handleKeyPressbefore callingonSubmit, using the keys frombuffer.pastedContentdirectly — no new imports or shared utilities needed.Related Issues
Closes #19944
Closes #19238
How to Validate
npm run build && npm start[Pasted Text: N lines]Pre-Merge Checklist