-
Notifications
You must be signed in to change notification settings - Fork 10.9k
feat: implement Steering Mode (Ctrl+O) for mid-flight course corrections #17452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement Steering Mode (Ctrl+O) for mid-flight course corrections #17452
Conversation
Summary of ChangesHello @CompilingChaos, 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 introduces a significant new feature called "Steering Mode," enabling users to provide real-time, asynchronous guidance and corrections to the agent without interrupting its ongoing tasks. This enhances user control by allowing mid-flight adjustments to the agent's behavior and plans, ensuring it stays aligned with user intent even during complex operations. Highlights
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.
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 introduces the 'Steering Mode' feature, designed to provide mid-flight corrections to the agent. While the implementation is well-structured, particularly the separation between the UI display text and the model's input via the displayText property, and the logic for persisting steering corrections across tool calls, a critical security vulnerability has been identified. The 'Respect Steering' mandate in the system prompt prioritizes content marked with the easily spoofable string (**STEERING CORRECTION**), making it vulnerable to Indirect Prompt Injection when the agent processes untrusted files or codebase content. This could enable an attacker to gain control over the agent's actions, potentially leading to Remote Code Execution. Additionally, there is a high-severity issue concerning how steering messages are handled for the user's input history and the message queue, which could lead to a confusing user experience.
- Update system prompt to instruct model to ignore steering tags in file content. - Inject active steering instruction at the end of user turns if steering is detected. - Add integration test for steering hijack mitigation.
|
/gemini review |
There was a problem hiding this 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 introduces a well-designed "Steering Mode" feature, allowing for mid-flight corrections to the agent. The implementation is robust, covering persistence across tool calls and separating UI display from model input. The inclusion of an integration test to prevent prompt injection from file contents is a commendable security measure. I've identified one high-severity logical issue in the core hook where a parameter is being used incorrectly, which could lead to future bugs.
|
/gemini review |
There was a problem hiding this 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 introduces a well-designed Steering Mode feature, enabling mid-flight course corrections for the agent. The implementation thoughtfully addresses asynchronous injection, persistence across turns, and UI/Model separation. The changes are comprehensive and align with the feature's goals.
|
Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request. To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues. If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding! |
Summary
This PR introduces Steering Mode (activated via
Ctrl+O), a "Human-in-the-loop" feature that allows users to provide asynchronous corrections or guidance to the agent while it is actively processing a task or streaming a response. This addresses the need for "mid-flight" course corrections without the heavy-handed approach ofCtrl+C.Details
**STEERING CORRECTION**block. This correction now persists through all continuation turns (tool responses) within a single task, ensuring the agent adheres to the correction even during complex multi-step operations.displayTextmechanism for history items. The UI renders a clean, user-friendly version of the steering message, while the model receives the full templated string containing internal instructions.STEERING MODE: Inject correction...) and toggle state to clearly distinguish between standard input and steering input.Architecture
displayTexttoHistoryItemBaseto decouple UI rendering from model input.useGeminiStreamwithpendingSteeringMessageRefandsteeringInjectedInCurrentTurnRefto manage correction injection across the tool loop.packages/core/src/core/prompts.tswith the "Respect Steering" rule and updated corresponding test snapshots.TOGGLE_STEERING_MODEtoCommandenum anddefaultKeyBindings.Related Issues
Closes #17197
How to Validate
Ctrl+Oand enter:Pre-Merge Checklist
keyBindings.ts)useGeminiStream.test.tsxand prompt snapshots)