Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bulkypanda
Copy link
Contributor

TLDR

continue processing pending tool calls if auto edit or yolo is triggered via keybinds

Dive Deeper

  • Integrate pending tool calls into auto-accept indicator hook
  • Add auto-approval of pending tool calls when switching to YOLO/AUTO_EDIT modes
  • Update ToolGroupMessage spacing for better visual separation
  • Add comprehensive test coverage for new auto-approval functionality
  • Export pending tool calls from useGeminiStream hook

Reviewer Test Plan

enable auto edit or yolo with pending tool calls using keybinds

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

@bulkypanda bulkypanda requested a review from a team as a code owner August 20, 2025 17:25
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @bulkypanda, 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 enhances the auto-approval workflow by integrating pending tool calls. It allows the system to automatically process pending tool calls when the user switches to YOLO or AUTO_EDIT modes via keybinds, improving the efficiency of automated operations. Additionally, it includes a minor UI adjustment for tool group messages.

Highlights

  • Enhanced Auto-Approval: Implemented logic to automatically approve pending tool calls when the YOLO or AUTO_EDIT modes are activated.
  • Conditional Tool Approval: In AUTO_EDIT mode, only 'replace' and 'write_file' tool calls are auto-approved, providing more granular control.
  • Improved UI Spacing: Adjusted the spacing for ToolGroupMessage components to enhance visual clarity.
  • Comprehensive Testing: Added extensive test coverage for the new auto-approval functionality, ensuring robustness and correctness.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the auto-approval workflow by processing pending tool calls when switching to YOLO or AUTO_EDIT modes. The changes are well-tested and the overall approach is good. However, there is a critical issue in useAutoAcceptIndicator.ts where forEach is used with an async function, which can lead to unhandled promises and potential race conditions. I've suggested a fix to use Promise.all to correctly handle the asynchronous operations.

Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great case to handle. some comments on how to handle it.

@bulkypanda
Copy link
Contributor Author

all addressed.

Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Approved once there are tests for the useGeminiStream.ts changes.

@bulkypanda bulkypanda requested a review from jacob314 August 22, 2025 23:01
@bulkypanda bulkypanda enabled auto-merge August 22, 2025 23:10
@bulkypanda bulkypanda disabled auto-merge August 23, 2025 22:44
@bulkypanda
Copy link
Contributor Author

bulkypanda commented Aug 23, 2025

#6941 and #7037 should be approved and merged before this.

…ration

- Integrate pending tool calls into auto-accept indicator hook
- Add auto-approval of pending tool calls when switching to YOLO/AUTO_EDIT modes
- Update ToolGroupMessage spacing for better visual separation
- Add comprehensive test coverage for new auto-approval functionality
- Export pending tool calls from useGeminiStream hook
Fixes race condition where forEach was used with async functions, which
doesn't wait for promises and can cause unhandled promise rejections.
Now uses Promise.all for concurrent processing with proper error handling.
…l processing

- Move auto-approval logic from useAutoAcceptIndicator to useGeminiStream
- Process tool calls sequentially instead of concurrently to reduce UI chaos
- Remove coupling between useAutoAcceptIndicator and pendingToolCalls
- Add handleApprovalModeChange callback to integrate with existing queue handling
- Update tests to reflect new architecture with callback-based approach
- Fix TypeScript type errors with proper TrackedWaitingToolCall type guards

Addresses code review feedback for improved separation of concerns and
better integration with existing tool call management infrastructure.
…niStream

- Test auto-approval behavior for YOLO mode (all pending tool calls)
- Test selective approval for AUTO_EDIT mode (only edit tools)
- Test no approval for REQUIRE_CONFIRMATION mode
- Add error handling tests for failed approvals
- Add edge case tests for missing confirmation details
- Test filtering by tool status (only awaiting_approval)
Fixes TypeScript build error caused by duplicate ApprovalMode identifier.
- Add type-only import for TrackedWaitingToolCall to fix verbatimModuleSyntax error
- Remove marginBottom=1 from ToolGroupMessage Box components for cleaner spacing
- Ensure build passes after upstream merge
Removed duplicate imports from useReactToolScheduler.js to resolve ESLint warnings.
- Fix missing pendingToolCalls parameter in useAutoAcceptIndicator call
- Add ToolConfirmationOutcome import to useGeminiStream.test.tsx
- Fix type import issues in useAutoAcceptIndicator.test.ts
- Ensure all tests pass and build succeeds
Remove duplicate auto-approve functionality from useAutoAcceptIndicator
and consolidate it in useGeminiStream.handleApprovalModeChange.

- Remove auto-approve logic from useAutoAcceptIndicator
- Update useAutoAcceptIndicator interface to remove pendingToolCalls param
- Remove unused pendingToolCalls variable from App.tsx
- Update tests to focus on approval mode change notifications only
- All auto-approve logic now centralized in useGeminiStream
@bulkypanda bulkypanda requested a review from jacob314 August 28, 2025 02:03
@bulkypanda bulkypanda changed the title feat: enhance auto-approval workflow with pending tool call integration feat: auto-approve pending tool calls when auto_edit/yolo is activated Aug 28, 2025
- Resolved merge conflicts in App.tsx (useLoadingIndicator and useAutoAcceptIndicator usage)
- Resolved merge conflicts in useGeminiStream.ts (import statements)
- Combined functionality from both branches
Resolved conflicts in:
- packages/cli/src/ui/AppContainer.tsx
- packages/cli/src/ui/hooks/useGeminiStream.ts

Combined return values from both branches to preserve functionality:
- Kept handleApprovalModeChange from HEAD
- Added activePtyId and loopDetectionConfirmationRequest from upstream
- Added pendingToolCalls export for compatibility
Extract hardcoded 'replace' and 'write_file' checks into EDIT_TOOL_NAMES constant to improve maintainability when adding new edit tools.
Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bulkypanda bulkypanda added this pull request to the merge queue Sep 15, 2025
Merged via the queue into google-gemini:main with commit 1145f25 Sep 15, 2025
40 of 41 checks passed
WangWanyue pushed a commit to WangWanyue/gemini-cli that referenced this pull request Sep 15, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Oct 2, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants