feat(core): implement silent fallback for Plan Mode model routing#25317
feat(core): implement silent fallback for Plan Mode model routing#25317
Conversation
This change introduces a 'Unified Injection' approach to enforce silent fallback when the system is in Plan Mode. By intercepting the ModelPolicyChain resolution, all fallback actions are overridden to 'silent', ensuring that failures in the primary planning model (Pro) automatically trigger a transition to the next available model (Flash) without interrupting the user. - Exported SILENT_ACTIONS from policyCatalog.ts - Refactored resolvePolicyChain in policyHelpers.ts to apply silent overrides - Added unit tests to verify silent fallback in Plan Mode
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 implements a silent fallback mechanism for Plan Mode to ensure a seamless user experience. By overriding model policy actions to 'silent' when Plan Mode is active, the system can automatically transition to alternative models without interrupting the user with prompts or blocking execution when primary models are unavailable. 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. Footnotes
|
|
Size Change: +242 B (0%) Total Size: 34.1 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request updates the documentation to reflect automatic model fallback behavior and implements a unified silent policy injection when the CLI is in Plan Mode. The resolvePolicyChain function was refactored to ensure consistent application of dynamic slicing and to override policy actions with SILENT_ACTIONS during planning. A review comment identifies a potential issue where SILENT_ACTIONS is assigned by reference, which could lead to shared state across policies; it is recommended to use the spread operator to provide each policy with its own instance of the actions map.
This addresses a review comment pointing out that assigning SILENT_ACTIONS directly could lead to shared state across policies. We now use the spread operator to provide each policy with its own instance of the actions map.
Summary
Implement silent fallback for Plan Mode to ensure an uninterrupted user experience when Pro models are unavailable or inaccessible.
Details
This PR introduces a "Unified Injection" approach to enforce silent fallback when the system is in Plan Mode. By intercepting the
ModelPolicyChainresolution inresolvePolicyChain, all fallback actions are overridden to 'silent' ifApprovalMode.PLANis active. This ensures that failures in the primary planning model (Pro) automatically trigger a transition to the next available model (Flash) without interrupting the user with prompts or getting "stuck".SILENT_ACTIONSfrompolicyCatalog.ts.resolvePolicyChaininpolicyHelpers.tsto apply silent overrides.policyHelpers.test.tsverifying silent fallback for both legacy and dynamic routing paths.docs/cli/plan-mode.mdto document the new behavior.Related Issues
Closes #25110
Pre-Merge Checklist