Uh oh!
There was an error while loading. Please reload this page.
feat: Adding Max Context Window setting for Gemini API provider - #4360
feat: Adding Max Context Window setting for Gemini API provider#4360HahaBill wants to merge 23 commits into
Conversation
- added `MaxContextWindowControl.tsx` - added maxContextWindow in `settings.json`
… + modifying context window in context condensing for Gemini
…Bill/Roo-Code into feat/set-max-context-window
…dded "maxContextWindow" to `settings.json`
- somehow Roo Code with Gemini 2.5 Pro deleted them during the task
…tWindow` overtakes the model's Gemini context window value setting
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…l.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…` for comprehension
…Bill/Roo-Code into feat/set-max-context-window
This reverts commit 16ffd71.
HahaBill
commented
Jun 9, 2025
Hi! I think something is wrong with the GitHub Actions for platform-unit-test (windows-latest), I am seeing the same/similar error for latest PRs too:
![]() When I changed this PR to from draft to ready to review, then there were not issues with GitHub Action. Once I added my changes because of |
hannesrudolph
commented
Jul 7, 2025
stale |
| }, | ||
| "maxContextWindow": { | ||
| "maxContextWindow": "Janela de Contexto Máxima", | ||
| "useCustom": "Usar janela de contexto máximo personalizada", |
There was a problem hiding this comment.
Typographical: 'Usar janela de contexto máximo personalizada' should use 'máxima' instead of 'máximo' for grammatical agreement with 'janela' (feminine), e.g. 'Usar janela de contexto máxima personalizada'.
| "useCustom": "Usar janela de contexto máximo personalizada", | |
| "useCustom": "Usar janela de contexto máxima personalizada", |

The PR will allow developers to set the maximum value of the context window in configuration profile, only for Gemini.
Related GitHub Issue
Closes: #3717
Description
Test Procedure
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Screenshots / Videos
Max Context Window in Configuration Profile
Displaying Gemini's Max Context Window
Testing Max Context Window with Intelligent Context Condensing
The set maximum context window is 32 000 tokens. Allowed tokens is:
const allowedTokens = contextWindow * (1 - TOKEN_BUFFER_PERCENTAGE) - reservedTokens, which in our case would be around ~22 000 tokens. Which proves that this PR works since the condensing was activated at 25 255 tokens.Documentation Updates
Additional Notes
Get in Touch
Important
Adds a configurable
maxContextWindowsetting for the Gemini API provider, updating schema, UI components, and tests to support this feature.maxContextWindowsetting togeminiSchemainprovider-settings.ts.GeminiHandleringemini.tsto usemaxContextWindowif set.TaskinTask.tsto respectmaxContextWindowfor Gemini.MaxContextWindowControlcomponent inMaxContextWindowControl.tsx.ApiOptions.tsxto includeMaxContextWindowControlfor Gemini.ModelInfoView.tsxto displaymaxContextWindow.maxContextWindowinTask.test.ts.MaxContextWindowControlinMaxContextWindowControl.test.tsx.maxContextWindowrelated strings in multiple languages.This description was created by
for 4e72a06. You can customize this summary. It will automatically update as commits are pushed.