Compare commits

..

9 Commits

Author SHA1 Message Date
gemini-cli-robot 0ded806d28 chore(release): v0.46.0-preview.1 2026-06-03 17:54:46 +00:00
gemini-cli-robot 700c96118c fix(patch): cherry-pick e4315b3 to release/v0.46.0-preview.0-pr-27645 to patch version v0.46.0-preview.0 and create version 0.46.0-preview.1 (#27655)
Co-authored-by: David Pierce <davidapierce@google.com>
2026-06-03 13:10:18 -04:00
gemini-cli-robot 480e2e7cdd chore(release): v0.46.0-preview.0 2026-06-03 00:36:56 +00:00
Sri Pasumarthi cfcecebe80 fix(ci): use pull_request_target trigger to grant write access on fork PRs (#27637) 2026-06-02 19:42:47 +00:00
Sri Pasumarthi 5110bdf56c chore(ci): add optimized PR size labeler and batch workflows (#27616) 2026-06-02 02:05:33 +00:00
David Pierce 665228e983 Transition to flash GA model when experiment flag is present. (#27570) 2026-06-01 23:36:49 +00:00
Tommaso Sciortino 013914071c Adding quote (#27571) 2026-05-29 13:43:16 -07:00
nirali 211e7d1aec fix(cli): prevent spam loop when preferredEditor is invalid (#25324)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
2026-05-29 13:43:03 -07:00
gemini-cli-robot b77beba13a Changelog for v0.44.0 (#27569)
Co-authored-by: gemini-cli-robot <224641728+gemini-cli-robot@users.noreply.github.com>
2026-05-29 19:40:17 +00:00
69 changed files with 1693 additions and 473 deletions
@@ -0,0 +1,107 @@
name: 'PR Size Labeler (Batch)'
on:
workflow_dispatch:
inputs:
process_all:
description: 'Process all PRs (open and closed) or open only'
required: true
default: 'false'
type: 'choice'
options:
- 'true'
- 'false'
limit:
description: 'Max number of PRs to fetch and check'
required: true
default: '100'
type: 'string'
permissions:
pull-requests: 'write'
jobs:
batch-label:
runs-on: 'ubuntu-latest'
steps:
- name: 'Batch label PRs'
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GH_REPO: '${{ github.repository }}'
run: |
# Determine the state filter
STATE="open"
if [ "${{ github.event.inputs.process_all }}" = "true" ]; then
STATE="all"
fi
LIMIT="${{ github.event.inputs.limit }}"
echo "Batch labeling up to $LIMIT $STATE PRs..."
# 1. Ensure standard premium size labels exist in the repository (self-healing)
gh label create "size/XS" --color "7ee081" --description "XS: <10 lines changed" 2>/dev/null || true
gh label create "size/S" --color "a6d49f" --description "S: 10-49 lines changed" 2>/dev/null || true
gh label create "size/M" --color "f7d070" --description "M: 50-249 lines changed" 2>/dev/null || true
gh label create "size/L" --color "f48c06" --description "L: 250-999 lines changed" 2>/dev/null || true
gh label create "size/XL" --color "dc2f02" --description "XL: >=1000 lines changed" 2>/dev/null || true
# 2. Query PR list with all required fields in ONE call to prevent N+1 queries
PR_LIST=$(gh pr list --state "$STATE" --limit "$LIMIT" --json number,additions,deletions,labels)
if [ -z "$PR_LIST" ] || [ "$PR_LIST" = "[]" ]; then
echo "️ No PRs found matching the criteria."
exit 0
fi
# Parse and iterate over PRs
UPDATED_COUNT=0
SKIPPED_COUNT=0
echo "$PR_LIST" | jq -c '.[]' | while read -r PR_JSON; do
PR_NUMBER=$(echo "$PR_JSON" | jq '.number')
ADDITIONS=$(echo "$PR_JSON" | jq '.additions')
DELETIONS=$(echo "$PR_JSON" | jq '.deletions')
TOTAL=$((ADDITIONS + DELETIONS))
# Calculate target size
if [ $TOTAL -lt 10 ]; then
SIZE="size/XS"
elif [ $TOTAL -lt 50 ]; then
SIZE="size/S"
elif [ $TOTAL -lt 250 ]; then
SIZE="size/M"
elif [ $TOTAL -lt 1000 ]; then
SIZE="size/L"
else
SIZE="size/XL"
fi
# Inspect existing labels to detect discrepancies
EXISTING_LABELS=$(echo "$PR_JSON" | jq -r '.labels[].name' 2>/dev/null || echo "")
LABELS_TO_REMOVE=()
for L in size/XS size/S size/M size/L size/XL; do
if echo "$EXISTING_LABELS" | grep -Fq "$L" && [ "$L" != "$SIZE" ]; then
LABELS_TO_REMOVE+=("--remove-label" "$L")
fi
done
LABEL_TO_ADD=()
if ! echo "$EXISTING_LABELS" | grep -Fq "$SIZE"; then
LABEL_TO_ADD+=("--add-label" "$SIZE")
fi
# Update labels if there's a difference
if [ ${#LABELS_TO_REMOVE[@]} -gt 0 ] || [ ${#LABEL_TO_ADD[@]} -gt 0 ]; then
echo "🔄 PR #$PR_NUMBER (+$ADDITIONS/-$DELETIONS = $TOTAL lines): updating size to $SIZE"
gh pr edit "$PR_NUMBER" "${LABELS_TO_REMOVE[@]}" "${LABEL_TO_ADD[@]}" 2>/dev/null || true
UPDATED_COUNT=$((UPDATED_COUNT + 1))
else
echo "✅ PR #$PR_NUMBER (+$ADDITIONS/-$DELETIONS = $TOTAL lines): already has correct label ($SIZE). Skipping."
SKIPPED_COUNT=$((SKIPPED_COUNT + 1))
fi
done
echo "============================================"
echo "🎉 Batch run completed!"
echo "Skipped (already correct): $SKIPPED_COUNT"
echo "Updated: $UPDATED_COUNT"
+120
View File
@@ -0,0 +1,120 @@
name: 'PR Size Labeler'
on:
pull_request_target:
types: ['opened', 'synchronize', 'reopened']
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to label manually (for workflow_dispatch)'
required: false
type: 'string'
permissions:
pull-requests: 'write'
issues: 'write'
jobs:
size-label:
runs-on: 'ubuntu-latest'
steps:
- name: 'Run size labeler'
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GH_REPO: '${{ github.repository }}'
run: |
# Determine the target PR number
if [ -n "${{ github.event.pull_request.number }}" ]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.inputs.pr_number }}" ]; then
PR_NUMBER="${{ github.event.inputs.pr_number }}"
else
echo "❌ Error: No PR number provided."
exit 1
fi
echo "Checking PR #$PR_NUMBER..."
# 1. Ensure standard premium size labels exist in the repository (self-healing)
# size/XS: Light green (#7ee081)
# size/S: Yellow-green (#a6d49f)
# size/M: Amber/Yellow (#f7d070)
# size/L: Orange (#f48c06)
# size/XL: Red (#dc2f02)
gh label create "size/XS" --color "7ee081" --description "XS: <10 lines changed" 2>/dev/null || true
gh label create "size/S" --color "a6d49f" --description "S: 10-49 lines changed" 2>/dev/null || true
gh label create "size/M" --color "f7d070" --description "M: 50-249 lines changed" 2>/dev/null || true
gh label create "size/L" --color "f48c06" --description "L: 250-999 lines changed" 2>/dev/null || true
gh label create "size/XL" --color "dc2f02" --description "XL: >=1000 lines changed" 2>/dev/null || true
# 2. Fetch PR details in a single efficient API call
PR_DATA=$(gh pr view "$PR_NUMBER" --json additions,deletions,changedFiles,labels)
if [ -z "$PR_DATA" ]; then
echo "❌ Error: Could not fetch PR details."
exit 1
fi
ADDITIONS=$(echo "$PR_DATA" | jq '.additions')
DELETIONS=$(echo "$PR_DATA" | jq '.deletions')
CHANGED_FILES=$(echo "$PR_DATA" | jq '.changedFiles')
TOTAL=$((ADDITIONS + DELETIONS))
echo "PR additions: $ADDITIONS, deletions: $DELETIONS, total changes: $TOTAL, files: $CHANGED_FILES"
# 3. Calculate new size label
if [ $TOTAL -lt 10 ]; then
SIZE="size/XS"
elif [ $TOTAL -lt 50 ]; then
SIZE="size/S"
elif [ $TOTAL -lt 250 ]; then
SIZE="size/M"
elif [ $TOTAL -lt 1000 ]; then
SIZE="size/L"
else
SIZE="size/XL"
fi
# 4. Check existing labels and update only if necessary
EXISTING_LABELS=$(echo "$PR_DATA" | jq -r '.labels[].name' 2>/dev/null || echo "")
LABELS_TO_REMOVE=()
for L in size/XS size/S size/M size/L size/XL; do
if echo "$EXISTING_LABELS" | grep -Fq "$L" && [ "$L" != "$SIZE" ]; then
LABELS_TO_REMOVE+=("--remove-label" "$L")
fi
done
LABEL_TO_ADD=()
if ! echo "$EXISTING_LABELS" | grep -Fq "$SIZE"; then
LABEL_TO_ADD+=("--add-label" "$SIZE")
fi
# Perform a single, highly atomic edit call if changes are needed
if [ ${#LABELS_TO_REMOVE[@]} -gt 0 ] || [ ${#LABEL_TO_ADD[@]} -gt 0 ]; then
echo "Updating labels: removing ${LABELS_TO_REMOVE[*]}, adding $SIZE"
gh pr edit "$PR_NUMBER" "${LABELS_TO_REMOVE[@]}" "${LABEL_TO_ADD[@]}"
else
echo "✅ PR #$PR_NUMBER already has the correct size label ($SIZE)."
fi
# 5. Premium, anti-spam comment logic (updates previous comment to keep thread clean)
COMMENT="📊 PR Size: **$SIZE**
- Lines changed: **$TOTAL**
- Additions: +$ADDITIONS
- Deletions: -$DELETIONS
- Files changed: $CHANGED_FILES"
# Find any existing size labeler comment by the github-actions bot
echo "Searching for existing size comment..."
COMMENT_ID=$(gh api "repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \
--jq '.[] | select(.user.login == "github-actions[bot]" and (.body | startswith("📊 PR Size:"))) | .id' | head -n 1)
if [ -n "$COMMENT_ID" ]; then
echo "Updating existing comment (ID: $COMMENT_ID)..."
gh api "repos/${{ github.repository }}/issues/comments/$COMMENT_ID" -X PATCH -f body="$COMMENT" > /dev/null
else
echo "Creating new comment..."
gh pr comment "$PR_NUMBER" --body "$COMMENT" > /dev/null
fi
echo "🎉 PR size labeling completed successfully."
+14
View File
@@ -18,6 +18,20 @@ on GitHub.
| [Preview](preview.md) | Experimental features ready for early feedback. |
| [Stable](latest.md) | Stable, recommended for general use. |
## Announcements: v0.44.0 - 2026-05-27
- **Unified Auto Mode:** Streamlined the automation experience by merging
specialized Auto modes into a single, unified mode
([#26714](https://github.com/google-gemini/gemini-cli/pull/26714) by
@DavidAPierce).
- **New Editor Integrations:** Added native support for Sublime Text and Emacs
Client ([#21090](https://github.com/google-gemini/gemini-cli/pull/21090) by
@alberti42).
- **Enhanced TUI Testing:** Introduced `agent-tui` and `tui-tester` skills for
programmatic testing and automation of terminal UI applications
([#27121](https://github.com/google-gemini/gemini-cli/pull/27121) by
@adamfweidman).
## Announcements: v0.43.0 - 2026-05-22
- **Surgical Code Edits:** Steered Gemini models to prefer the `edit` tool for
+202 -199
View File
@@ -1,6 +1,6 @@
# Latest stable release: v0.43.0
# Latest stable release: v0.44.0
Released: May 22, 2026
Released: May 27, 2026
For most users, our latest stable release is the recommended release. Install
the latest stable version with:
@@ -11,208 +11,211 @@ npm install -g @google/gemini-cli
## Highlights
- **Surgical Code Edits:** Gemini models are now steered to prefer the `edit`
tool for surgical modifications, leading to faster and more precise code
updates.
- **Session Portability:** Introduced features to export active sessions to
files and import them later via a CLI flag, allowing for easier session
sharing and resumption.
- **Adaptive Token Estimation:** A new adaptive token calculator provides more
accurate content size measurements, optimizing context window usage and
reducing API overhead.
- **Improved UI Rendering:** Core tools now utilize native `ToolDisplay`
properties, fixing various UI rendering issues and improving the experience in
ACP-compliant IDEs.
- **Enhanced Agent Architecture:** Introduced `LocalSubagentProtocol` and
`RemoteSubagentProtocol` behind a unified `AgentProtocol`, laying the
groundwork for more complex multi-agent interactions.
- **Unified Auto Mode:** Merged all "Auto" modes into a single, unified Auto
mode, simplifying the automation workflow and providing a more consistent
experience across tasks.
- **Expanded Editor Support:** Native support for Sublime Text and Emacs Client
has been added, giving developers more flexibility in their choice of external
editors.
- **TUI Automation Skills:** New `agent-tui` and `tui-tester` skills enable the
programmatic testing and automation of terminal UI (TUI) applications,
facilitating robust verification of terminal-based tools.
- **Improved UI Performance:** Throttled shell text output and added bounds to
the live UI buffer to ensure smooth rendering and stability during high-volume
output sessions.
- **Stabilized Sandbox Environments:** Explicitly clearing entrypoints when
spawning sandbox containers ensures reliable and consistent environment
initialization across different Linux distributions.
## What's Changed
- feat(core): steer model to use edit tool for surgical edits, fix a typo by
@aishaneeshah in
[#26480](https://github.com/google-gemini/gemini-cli/pull/26480)
- docs: clarify Auto Memory proposes memory updates and skills by @SandyTao520
in [#26527](https://github.com/google-gemini/gemini-cli/pull/26527)
- fix(core): reject numeric project IDs in GOOGLE_CLOUD_PROJECT (#24695) by
@Abhijit-2592 in
[#26532](https://github.com/google-gemini/gemini-cli/pull/26532)
- fix(core): remove unsafe type assertion suppressions in error utils by
@himanshu748 in
[#19881](https://github.com/google-gemini/gemini-cli/pull/19881)
- fix(core): allow redirection in YOLO and AUTO_EDIT modes without sandboxing by
@galz10 in [#26542](https://github.com/google-gemini/gemini-cli/pull/26542)
- ci(release): build and attach unsigned macOS binaries to releases by @ruomengz
in [#26462](https://github.com/google-gemini/gemini-cli/pull/26462)
- fix(core): Fix chat corruption bug in context manager. by @joshualitt in
[#26534](https://github.com/google-gemini/gemini-cli/pull/26534)
- fix(cli): provide JSON output for AgentExecutionStopped in non-interactive
mode by @cynthialong0-0 in
[#26504](https://github.com/google-gemini/gemini-cli/pull/26504)
- feat(evals): add shell command safety evals by @akh64bit in
[#26528](https://github.com/google-gemini/gemini-cli/pull/26528)
- fix(core): handle invalid custom plans directory gracefully by @cynthialong0-0
in [#26560](https://github.com/google-gemini/gemini-cli/pull/26560)
- fix(acp): move tool explanation from thought stream to tool call content by
@sripasg in [#26554](https://github.com/google-gemini/gemini-cli/pull/26554)
- fix(a2a-server): Resolve race condition in tool completion waiting by @kschaab
in [#26568](https://github.com/google-gemini/gemini-cli/pull/26568)
- fix(cli): randomize sandbox container names by @Kkartik14 in
[#26014](https://github.com/google-gemini/gemini-cli/pull/26014)
- fix(core): Fix hysteresis in async context management pipelines. by
@joshualitt in
[#26452](https://github.com/google-gemini/gemini-cli/pull/26452)
- Tighten private Auto Memory patch allowlist by @SandyTao520 in
[#26535](https://github.com/google-gemini/gemini-cli/pull/26535)
- fix(cli): hide read-only settings scopes by @cvan20191 in
[#26249](https://github.com/google-gemini/gemini-cli/pull/26249)
- fix(ci): preserve executable bit for mac binaries by @ruomengz in
[#26600](https://github.com/google-gemini/gemini-cli/pull/26600)
- fix(cli): improve mcp list UX in untrusted folders by @Adib234 in
[#26457](https://github.com/google-gemini/gemini-cli/pull/26457)
- fix(core): prevent silent hang during OAuth auth on headless Linux by
@RhysSullivan in
[#26571](https://github.com/google-gemini/gemini-cli/pull/26571)
- Changelog for v0.42.0-preview.0 by @gemini-cli-robot in
[#26537](https://github.com/google-gemini/gemini-cli/pull/26537)
- ci: fix Argument list too long in triage workflows by @cocosheng-g in
[#26603](https://github.com/google-gemini/gemini-cli/pull/26603)
- refactor(cli): migrate core tools to native ToolDisplay property and fix UI
rendering by @mbleigh in
[#25186](https://github.com/google-gemini/gemini-cli/pull/25186)
- don't wrap args unnecessarily by @scidomino in
[#26599](https://github.com/google-gemini/gemini-cli/pull/26599)
- fix(core): preserve system PATH in Git environment to fix ENOENT (#25034) by
- chore(release): bump version to 0.44.0-nightly.20260512.g022e8baef by
@gemini-cli-robot in
[#26957](https://github.com/google-gemini/gemini-cli/pull/26957)
- Changelog for v0.42.0 by @gemini-cli-robot in
[#26958](https://github.com/google-gemini/gemini-cli/pull/26958)
- Refactor: Eliminate `no-unsafe-return` suppressions via strict type validation
by @M-DEV-1 in
[#20668](https://github.com/google-gemini/gemini-cli/pull/20668)
- Changelog for v0.43.0-preview.0 by @gemini-cli-robot in
[#26959](https://github.com/google-gemini/gemini-cli/pull/26959)
- feat(core): change agent registration to first-wins and prioritize project by
@adamfweidman in
[#26953](https://github.com/google-gemini/gemini-cli/pull/26953)
- feat(cli): merge Auto modes into a single Auto mode by @DavidAPierce in
[#26714](https://github.com/google-gemini/gemini-cli/pull/26714)
- fix(core): preserve OAuth refresh tokens during rotation and retrieval by
@cocosheng-g in
[#26587](https://github.com/google-gemini/gemini-cli/pull/26587)
- fix(routing): fix resolveClassifierModel argument mismatch in
ApprovalModeStrategy by @danielweis in
[#26658](https://github.com/google-gemini/gemini-cli/pull/26658)
- docs: add vi mode shortcuts and clarify MCP/custom sandbox setup by
@chrisjcthomas in
[#23853](https://github.com/google-gemini/gemini-cli/pull/23853)
- fix(ux): fixed issue with transcribed text not showing after releasing space
by @devr0306 in
[#26609](https://github.com/google-gemini/gemini-cli/pull/26609)
- ci: fix json parsing in scheduled triage workflow by @cocosheng-g in
[#26656](https://github.com/google-gemini/gemini-cli/pull/26656)
- fix(cli): hide /memory add subcommand when memoryV2 is enabled by @SandyTao520
in [#26605](https://github.com/google-gemini/gemini-cli/pull/26605)
- fix: prevent false command conflicts when launching from home directory by
@Br1an67 in [#23069](https://github.com/google-gemini/gemini-cli/pull/23069)
- fix(core): cache model routing decision in LocalAgentExecutor by @akh64bit in
[#26548](https://github.com/google-gemini/gemini-cli/pull/26548)
- Changelog for v0.42.0-preview.2 by @gemini-cli-robot in
[#26597](https://github.com/google-gemini/gemini-cli/pull/26597)
- skip broken test by @scidomino in
[#26705](https://github.com/google-gemini/gemini-cli/pull/26705)
- feat: export session to file and import via flag by @cocosheng-g in
[#26514](https://github.com/google-gemini/gemini-cli/pull/26514)
- Feat: Add Machine Hostname to CLI interface by @M-DEV-1 in
[#25637](https://github.com/google-gemini/gemini-cli/pull/25637)
- docs(extensions): refactor releasing guide and add update mechanisms by
@ruomengz in [#26595](https://github.com/google-gemini/gemini-cli/pull/26595)
- fix(ci): fix maintainer identification in lifecycle manager by @gundermanc in
[#26706](https://github.com/google-gemini/gemini-cli/pull/26706)
- fix(ui): added quotes around session id in resume tip by @devr0306 in
[#26669](https://github.com/google-gemini/gemini-cli/pull/26669)
- Changelog for v0.41.0 by @gemini-cli-robot in
[#26670](https://github.com/google-gemini/gemini-cli/pull/26670)
- refactor(core): agent session protocol changes by @adamfweidman in
[#26661](https://github.com/google-gemini/gemini-cli/pull/26661)
- fix(context): implement loose boundary policy for gc backstop. by @joshualitt
in [#26594](https://github.com/google-gemini/gemini-cli/pull/26594)
- fix(core): throw explicit error on dropped tool responses by @aishaneeshah in
[#26668](https://github.com/google-gemini/gemini-cli/pull/26668)
- fix: resolve "function response turn must come immediately after function
call" error by @danielweis in
[#26691](https://github.com/google-gemini/gemini-cli/pull/26691)
- fix(core): resolve parallel tool call streaming ID collision by @aishaneeshah
in [#26646](https://github.com/google-gemini/gemini-cli/pull/26646)
- feat(core): add LocalSubagentProtocol behind AgentProtocol by @adamfweidman in
[#25302](https://github.com/google-gemini/gemini-cli/pull/25302)
- fix(cli): remove noisy theme registration logs from terminal by @JayadityaGit
in [#25858](https://github.com/google-gemini/gemini-cli/pull/25858)
- ci: implement codebase-aware effort level triage by @cocosheng-g in
[#26666](https://github.com/google-gemini/gemini-cli/pull/26666)
- feat(acp/core): prefix tool call IDs with tool names to support tool rendering
in ACP compliant IDEs. by @sripasg in
[#26676](https://github.com/google-gemini/gemini-cli/pull/26676)
- fix(mcp): treat GET 404 as 405 in StreamableHTTPClientTransport by @krishdef7
in [#24847](https://github.com/google-gemini/gemini-cli/pull/24847)
- feat(core): add RemoteSubagentProtocol behind AgentProtocol by @adamfweidman
in [#25303](https://github.com/google-gemini/gemini-cli/pull/25303)
- feat(context): Improvements to the snapshotter. by @joshualitt in
[#26655](https://github.com/google-gemini/gemini-cli/pull/26655)
- fix(context): Change snapshotter model config. by @joshualitt in
[#26745](https://github.com/google-gemini/gemini-cli/pull/26745)
- fix(cli): allow installing extensions from ssh repo by @danielmundi in
[#26274](https://github.com/google-gemini/gemini-cli/pull/26274)
- fix(cli): prevent duplicate SessionStart systemMessage render by @dimssu in
[#25827](https://github.com/google-gemini/gemini-cli/pull/25827)
- fix(cli/acp): prevent infinite thought loop in ACP mode by disablig
nextSpeakerCheck by @sripasg in
[#26874](https://github.com/google-gemini/gemini-cli/pull/26874)
- fix(cli): use static tool name in confirmation prompt to avoid parsing errors
by @cocosheng-g in
[#26866](https://github.com/google-gemini/gemini-cli/pull/26866)
- fix(routing): Refactor tool turn handling for the conversation history in
NumericalClassifierStrategy to prevent 400 Bad Request by @danielweis in
[#26761](https://github.com/google-gemini/gemini-cli/pull/26761)
- fix(core): handle malformed projects.json in ProjectRegistry by @cocosheng-g
in [#26885](https://github.com/google-gemini/gemini-cli/pull/26885)
- fix(ui): added a gutter width to the input prompt width calculation by
@devr0306 in [#26882](https://github.com/google-gemini/gemini-cli/pull/26882)
- fix: prevent EISDIR crash when customIgnoreFilePaths contains directories
(#19868) by @suhaan-24 in
[#19898](https://github.com/google-gemini/gemini-cli/pull/19898)
- revert 6b9b778d821728427eea07b1b97ba07378137d0b by @danielweis in
[#26893](https://github.com/google-gemini/gemini-cli/pull/26893)
- Fix/vscode run current file ts by @Neil-N4 in
[#22894](https://github.com/google-gemini/gemini-cli/pull/22894)
- Allow Enter to select session while in search mode in /resume by @f-pieri in
[#21523](https://github.com/google-gemini/gemini-cli/pull/21523)
- fix(core): ignore .pak and .rpa game archive formats by default by @Eswar809
in [#26884](https://github.com/google-gemini/gemini-cli/pull/26884)
- fix(cli): enable adk non-interactive session by @adamfweidman in
[#26895](https://github.com/google-gemini/gemini-cli/pull/26895)
- fix(cli): restore resume for legacy sessions by @KurodaKayn in
[#26577](https://github.com/google-gemini/gemini-cli/pull/26577)
- fix: respect explicit model selection after Flash quota exhaustion (#26759) by
[#26924](https://github.com/google-gemini/gemini-cli/pull/26924)
- fix(cli): allow keychain auth for --list-sessions and non-interactive mode by
@cocosheng-g in
[#26872](https://github.com/google-gemini/gemini-cli/pull/26872)
- feat(context): Introduce adaptive token calculator to more accurately
calculate content sizes. by @joshualitt in
[#26888](https://github.com/google-gemini/gemini-cli/pull/26888)
- chore: update checkout action configuration in workflows by @galz10 in
[#26897](https://github.com/google-gemini/gemini-cli/pull/26897)
- fix (telemetry): inject quota_project_id to prevent fallback to default oauth
client by @TNTCompany in
[#26698](https://github.com/google-gemini/gemini-cli/pull/26698)
- Exclude extension context from skill extraction agent by @SandyTao520 in
[#26879](https://github.com/google-gemini/gemini-cli/pull/26879)
- Enable NumericalRouter when using dynamic model configs by @kevinjwang1 in
[#26929](https://github.com/google-gemini/gemini-cli/pull/26929)
- ci: actively triage missing priority labels and intelligently clean up
conflicting labels by @cocosheng-g in
[#26865](https://github.com/google-gemini/gemini-cli/pull/26865)
- refactor(core): introduce SubagentState enum for progress by @adamfweidman in
[#26934](https://github.com/google-gemini/gemini-cli/pull/26934)
- fix(ci): replace brittle --no-tag with explicit staging-tmp tag by @scidomino
in [#26940](https://github.com/google-gemini/gemini-cli/pull/26940)
- Incremental refactor repo agent towards skills-based composition by
@gundermanc in
[#26717](https://github.com/google-gemini/gemini-cli/pull/26717)
- fix(ui): fixed line wrap padding for selection lists by @devr0306 in
[#26944](https://github.com/google-gemini/gemini-cli/pull/26944)
- fix(core): update read_file schema for v1 compatibility (#22183) by
[#26921](https://github.com/google-gemini/gemini-cli/pull/26921)
- fix(core): handle EISDIR on virtual drives in memory discovery by @cocosheng-g
in [#26985](https://github.com/google-gemini/gemini-cli/pull/26985)
- fix(cli): auto-approve shell redirections in AUTO_EDIT mode by @cocosheng-g in
[#27003](https://github.com/google-gemini/gemini-cli/pull/27003)
- ci: suppress bot comments during standard triage maintenance by @cocosheng-g
in [#27006](https://github.com/google-gemini/gemini-cli/pull/27006)
- fix(core): refresh MCP OAuth token usage after re-auth by @sahilkirad in
[#26312](https://github.com/google-gemini/gemini-cli/pull/26312)
- fix(ui): clamped table column widths by @devr0306 in
[#26991](https://github.com/google-gemini/gemini-cli/pull/26991)
- fix(core): isolate subagent thread context by @akh64bit in
[#26449](https://github.com/google-gemini/gemini-cli/pull/26449)
- chore: add execution permission to scripts/review.sh by @scidomino in
[#27009](https://github.com/google-gemini/gemini-cli/pull/27009)
- fix(core): made context files append instead of replace by @devr0306 in
[#26950](https://github.com/google-gemini/gemini-cli/pull/26950)
- fix: add system PATH fallback for ripgrep resolution (#26777) by @cocosheng-g
in [#26868](https://github.com/google-gemini/gemini-cli/pull/26868)
- chore: clean up launched memory features by @SandyTao520 in
[#26941](https://github.com/google-gemini/gemini-cli/pull/26941)
- fix(core): throttle shell text output and bound live UI buffer by
@emersonbusson in
[#26955](https://github.com/google-gemini/gemini-cli/pull/26955)
- fix(cli): don't crash when an @-mention captures a non-path blob by @ifitisit
in [#25980](https://github.com/google-gemini/gemini-cli/pull/25980)
- fix(core): ensure stable fallback for restricted preview models by @galz10 in
[#26999](https://github.com/google-gemini/gemini-cli/pull/26999)
- feat(core): expose RAG snippets to local log file for debugging by @spencer426
in [#27016](https://github.com/google-gemini/gemini-cli/pull/27016)
- fix(acp/auth): prevent conflicting credentials on enterprise gateways and
support optional API keys natively by @sripasg in
[#27021](https://github.com/google-gemini/gemini-cli/pull/27021)
- fix(core): respect NO_PROXY for network-based MCP servers by @cocosheng-g in
[#27012](https://github.com/google-gemini/gemini-cli/pull/27012)
- fix(cli): resolve permission denied in sandbox on NixOS and other distros by
@cocosheng-g in
[#26922](https://github.com/google-gemini/gemini-cli/pull/26922)
- fix(ci): configure git remote with token for authentication by @scidomino in
[#26949](https://github.com/google-gemini/gemini-cli/pull/26949)
- fix(patch): cherry-pick 85566a7 to release/v0.43.0-preview.0-pr-27073
[CONFLICTS] by @gemini-cli-robot in
[#27256](https://github.com/google-gemini/gemini-cli/pull/27256)
[#27004](https://github.com/google-gemini/gemini-cli/pull/27004)
- fix(ui): preserve new line at the end of edit window by @devr0306 in
[#27057](https://github.com/google-gemini/gemini-cli/pull/27057)
- fix(core): ensure Vertex AI sets hasAccessToPreviewModels and remove
aggressive 404 fallback revocation by @galz10 in
[#27067](https://github.com/google-gemini/gemini-cli/pull/27067)
- fix(core): ensure stable admin settings comparison across IPC to prevent
restart loop by @DavidAPierce in
[#27066](https://github.com/google-gemini/gemini-cli/pull/27066)
- fix(deps): update vulnerable dependencies by @scidomino in
[#27062](https://github.com/google-gemini/gemini-cli/pull/27062)
- fix(core): resolve EISDIR errors during file processing (#21527) by @ProthamD
in [#27041](https://github.com/google-gemini/gemini-cli/pull/27041)
- docs(extensions): clarify env var sanitization policy for MCP and ext… by
@galz10 in [#22854](https://github.com/google-gemini/gemini-cli/pull/22854)
- fix(ui): add ENAMETOOLONG and ENOTDIR to exceptions for file parsing errors by
@devr0306 in [#27069](https://github.com/google-gemini/gemini-cli/pull/27069)
- fix(cli): explicitly clear entrypoint when spawning sandbox container by
@cocosheng-g in
[#27059](https://github.com/google-gemini/gemini-cli/pull/27059)
- docs: update sandbox image command by @sjhddh in
[#26774](https://github.com/google-gemini/gemini-cli/pull/26774)
- fix(core): externalize https-proxy-agent to fix proxy support by @sotokisehiro
in [#26361](https://github.com/google-gemini/gemini-cli/pull/26361)
- security: update dependencies to fix critical and high vulnerabilities by
@scidomino in [#27077](https://github.com/google-gemini/gemini-cli/pull/27077)
- Fix/web fetch ctrl c abort by @ProthamD in
[#24320](https://github.com/google-gemini/gemini-cli/pull/24320)
- fix(core): add aliases and thinking config for gemini-3.1 models by
@anishs1207 in
[#27007](https://github.com/google-gemini/gemini-cli/pull/27007)
- fix(core): use hasAccessToPreview for auto model resolution and fix
disappearing models by @DavidAPierce in
[#27112](https://github.com/google-gemini/gemini-cli/pull/27112)
- feat(core): add adk.agentSessionSubagentEnabled flag by @adamfweidman in
[#26947](https://github.com/google-gemini/gemini-cli/pull/26947)
- fix(core): enforce compile-time exhaustiveness in content-utils by
@adamfweidman in
[#27207](https://github.com/google-gemini/gemini-cli/pull/27207)
- feat(skills): add agent-tui and tui-tester skills by @adamfweidman in
[#27121](https://github.com/google-gemini/gemini-cli/pull/27121)
- fix(context): Fix snapshot recovery across sessions. by @joshualitt in
[#26939](https://github.com/google-gemini/gemini-cli/pull/26939)
- fix(core): add unit tests for stableStringify by @devr0306 in
[#27212](https://github.com/google-gemini/gemini-cli/pull/27212)
- fix(core): prefer pwsh.exe over Windows PowerShell 5.1 (#25859) by @kaluchi in
[#25900](https://github.com/google-gemini/gemini-cli/pull/25900)
- feat(core): add LocalSessionInvocation by @adamfweidman in
[#26665](https://github.com/google-gemini/gemini-cli/pull/26665)
- refactor: decouple auto model description and configuration from
releaseChannel by @danielweis in
[#27227](https://github.com/google-gemini/gemini-cli/pull/27227)
- fix(core): prevent isBinary false-positive on Windows PTY streams by
@TirthNaik-99 in
[#26565](https://github.com/google-gemini/gemini-cli/pull/26565)
- fix(cli): Prevent unmapped keys in Vim Normal mode from inserting text into
prompt Input. by @Rajeshpatel07 in
[#25139](https://github.com/google-gemini/gemini-cli/pull/25139)
- fix(a2a-server): Implement default policy loading for parity with CLI by
@kschaab in [#27073](https://github.com/google-gemini/gemini-cli/pull/27073)
- feat(core): add RemoteSessionInvocation by @adamfweidman in
[#26937](https://github.com/google-gemini/gemini-cli/pull/26937)
- fix: allow configured MCP servers in non-interactive mode by @cocosheng-g in
[#27215](https://github.com/google-gemini/gemini-cli/pull/27215)
- fix(core): add exception handling to migrateFromFileStorage by @devr0306 in
[#27229](https://github.com/google-gemini/gemini-cli/pull/27229)
- fix(cli): bundle ink worker-entry.js by @rmedranollamas in
[#27249](https://github.com/google-gemini/gemini-cli/pull/27249)
- feat(core): wire AgentSession invocations into agent-tool by @adamfweidman in
[#26948](https://github.com/google-gemini/gemini-cli/pull/26948)
- fix(core): prevent path traversal in custome command file injection by
@ompatel-aiml in
[#27234](https://github.com/google-gemini/gemini-cli/pull/27234)
- fix(core): respect NO_PROXY in global fetch dispatcher by @cocosheng-g in
[#27216](https://github.com/google-gemini/gemini-cli/pull/27216)
- fix(core): correctly handle nullable array types in MCP tools by @devr0306 in
[#27228](https://github.com/google-gemini/gemini-cli/pull/27228)
- fix(cli): preserve proxy-agent named exports in ESM bundle by @ashishch432 in
[#27145](https://github.com/google-gemini/gemini-cli/pull/27145)
- Proposal: deterministic encoding for child-process I/O by @kaluchi in
[#27247](https://github.com/google-gemini/gemini-cli/pull/27247)
- feat(cli): add Sublime Text and Emacs Client editors, improve error messages
and documentation by @alberti42 in
[#21090](https://github.com/google-gemini/gemini-cli/pull/21090)
- Changelog for v0.43.0-preview.1 by @gemini-cli-robot in
[#27297](https://github.com/google-gemini/gemini-cli/pull/27297)
- fix(devtools): bundle devtools package to avoid resolution errors by
@rmedranollamas in
[#27250](https://github.com/google-gemini/gemini-cli/pull/27250)
- fix(cli): integrate PolicyEngine into ACP session to prevent deadlocks
(#23507) by @cocosheng-g in
[#27252](https://github.com/google-gemini/gemini-cli/pull/27252)
- fix: robust ripgrep path resolution and 1p hermetic execution support by
@cocosheng-g in
[#27253](https://github.com/google-gemini/gemini-cli/pull/27253)
- refactor: decouple stored session deletion from ChatRecordingService (#22920)
by @yuvrajangadsingh in
[#27039](https://github.com/google-gemini/gemini-cli/pull/27039)
- fix(core): improve Alpine shell compatibility by @dibyx in
[#26770](https://github.com/google-gemini/gemini-cli/pull/26770)
- fix(core): generalize MCP compliance fix for tool results by @cocosheng-g in
[#27045](https://github.com/google-gemini/gemini-cli/pull/27045)
- fix(scripts): scrub CI env vars in dev to keep interactive mode by @Hashaam101
in [#27159](https://github.com/google-gemini/gemini-cli/pull/27159)
- fix(core): Added date field for the GCal MCP by @devr0306 in
[#27251](https://github.com/google-gemini/gemini-cli/pull/27251)
- fix(core): centralize path validation to prevent crashes from malformed
prompts by @cocosheng-g in
[#27211](https://github.com/google-gemini/gemini-cli/pull/27211)
- fix(core): prevent SIGHUP kills in PTY environments (WSL2/Kitty/Alacritty) by
@ProthamD in [#27267](https://github.com/google-gemini/gemini-cli/pull/27267)
- fix(core): dynamic fallback routing for exhausted quota models by @cocosheng-g
in [#27315](https://github.com/google-gemini/gemini-cli/pull/27315)
- Auto detect pnpm global installation path for macOS and Windows by @tisonkun
in [#22748](https://github.com/google-gemini/gemini-cli/pull/22748)
- fix(windows): resolve interactive shell arrow-key navigation on Windows by
@KumarADITHYA123 in
[#23505](https://github.com/google-gemini/gemini-cli/pull/23505)
- ci: robust stale issue lifecycle and consolidated triage labels by
@cocosheng-g in
[#27015](https://github.com/google-gemini/gemini-cli/pull/27015)
- fix(context): Ensure last message is processed. by @joshualitt in
[#27232](https://github.com/google-gemini/gemini-cli/pull/27232)
- chore/release: bump version to 0.44.0-nightly.20260521.g57c42a5c4 by
@gemini-cli-robot in
[#27324](https://github.com/google-gemini/gemini-cli/pull/27324)
- fix(ui): added volta to auto update check by @devr0306 in
[#27353](https://github.com/google-gemini/gemini-cli/pull/27353)
- perf: optimize issue triage and lifecycle management by @cocosheng-g in
[#27346](https://github.com/google-gemini/gemini-cli/pull/27346)
**Full Changelog**:
https://github.com/google-gemini/gemini-cli/compare/v0.42.0...v0.43.0
https://github.com/google-gemini/gemini-cli/compare/v0.43.0...v0.44.0
+29 -1
View File
@@ -154,7 +154,35 @@ and will never be auto-unassigned.
- **Unassign yourself** if you can no longer work on the issue by commenting
`/unassign`, so other contributors can pick it up right away.
### 6. Release automation
### 6. Automatically label PRs by size: `PR Size Labeler`
To help maintainers estimate review effort and keep the PR history clean, this
workflow automatically tags every pull request with a size label representing
the total volume of line changes.
- **Workflow File**: `.github/workflows/pr-size-labeler.yml`
- **When it runs**: Immediately after a pull request is created, synchronized
(new commits pushed), or reopened. It can also be triggered manually via
`workflow_dispatch` with a PR number.
- **What it does**:
- **Calculates total changes**: Summarizes additions and deletions across all
changed files in a single consolidated API request.
- **Applies standard size labels**:
- `size/XS`: < 10 lines changed
- `size/S`: 10-49 lines changed
- `size/M`: 50-249 lines changed
- `size/L`: 250-999 lines changed
- `size/XL`: >= 1000 lines changed
- **Updates size tag atomically**: Adds the new correct size label and removes
any obsolete size labels in one atomic step.
- **Updates/Posts PR size info comment**: Instead of spamming a new comment on
every commit push, it updates the existing size labeler status comment
inline to keep the PR conversation timeline perfectly neat and clean.
- **What you should do**:
- You do not need to take any actions. The workflow runs automatically and
updates the label and comment seamlessly as you push new updates.
### 7. Release automation
This workflow handles the process of packaging and publishing new versions of
Gemini CLI.
+71
View File
@@ -602,6 +602,12 @@ their corresponding top-level category object in your `settings.json` file.
"model": "gemini-3.1-flash-lite"
}
},
"gemini-3.5-flash": {
"extends": "chat-base-3",
"modelConfig": {
"model": "gemini-3.5-flash"
}
},
"gemma-4-31b-it": {
"extends": "chat-base-3",
"modelConfig": {
@@ -626,6 +632,12 @@ their corresponding top-level category object in your `settings.json` file.
"model": "gemini-3-flash-preview"
}
},
"gemini-3.5-flash-base": {
"extends": "base",
"modelConfig": {
"model": "gemini-3.5-flash"
}
},
"classifier": {
"extends": "base",
"modelConfig": {
@@ -868,6 +880,16 @@ their corresponding top-level category object in your `settings.json` file.
"multimodalToolUse": true
}
},
"gemini-3.5-flash": {
"tier": "flash",
"family": "gemini-3",
"isPreview": false,
"isVisible": true,
"features": {
"thinking": false,
"multimodalToolUse": true
}
},
"gemini-2.5-pro": {
"tier": "pro",
"family": "gemini-2.5",
@@ -1020,9 +1042,46 @@ their corresponding top-level category object in your `settings.json` file.
"contexts": [
{
"condition": {
"hasAccessToPreview": false,
"useGemini3_5Flash": true
},
"target": "gemini-3.5-flash"
},
{
"condition": {
"hasAccessToPreview": false,
"useGemini3_5Flash": false
},
"target": "gemini-2.5-flash"
}
]
},
"gemini-3.5-flash": {
"default": "gemini-3.5-flash",
"contexts": [
{
"condition": {
"useGemini3_5Flash": false,
"hasAccessToPreview": false
},
"target": "gemini-2.5-flash"
},
{
"condition": {
"useGemini3_5Flash": false
},
"target": "gemini-3-flash-preview"
}
]
},
"gemini-2.5-flash": {
"default": "gemini-2.5-flash",
"contexts": [
{
"condition": {
"useGemini3_5Flash": true
},
"target": "gemini-3.5-flash"
}
]
},
@@ -1104,6 +1163,12 @@ their corresponding top-level category object in your `settings.json` file.
"flash": {
"default": "gemini-3-flash-preview",
"contexts": [
{
"condition": {
"useGemini3_5Flash": true
},
"target": "gemini-3.5-flash"
},
{
"condition": {
"hasAccessToPreview": false
@@ -1157,6 +1222,12 @@ their corresponding top-level category object in your `settings.json` file.
"flash": {
"default": "gemini-3-flash-preview",
"contexts": [
{
"condition": {
"useGemini3_5Flash": true
},
"target": "gemini-3.5-flash"
},
{
"condition": {
"hasAccessToPreview": false
+24 -4
View File
@@ -76,10 +76,30 @@ export class LLMJudge {
for (const res of rawResults) {
// Remove any punctuation the model might have appended
const cleanRes = res.replace(/[^A-Z]/g, '');
if (cleanRes.startsWith('YES')) yes++;
else if (cleanRes.startsWith('NO')) no++;
else other++;
const cleanRes = res.replace(/[^A-Z ]/g, '');
if (
cleanRes.includes('THE ANSWER IS YES') ||
cleanRes.includes('ANSWER IS YES') ||
cleanRes.endsWith('YES')
) {
yes++;
} else if (
cleanRes.includes('THE ANSWER IS NO') ||
cleanRes.includes('ANSWER IS NO') ||
cleanRes.endsWith('NO')
) {
no++;
} else if (cleanRes.trim() === 'YES') {
yes++;
} else if (cleanRes.trim() === 'NO') {
no++;
} else {
// Fallback: look for YES or NO as standalone words or at the end
const words = cleanRes.split(/\s+/);
if (words.includes('YES')) yes++;
else if (words.includes('NO')) no++;
else other++;
}
}
// Pass if YES > NO and YES > OTHER (plurality)
+9 -9
View File
@@ -1,12 +1,12 @@
{
"name": "@google/gemini-cli",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@google/gemini-cli",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"workspaces": [
"packages/*"
],
@@ -18117,7 +18117,7 @@
},
"packages/a2a-server": {
"name": "@google/gemini-cli-a2a-server",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"dependencies": {
"@a2a-js/sdk": "0.3.11",
"@google-cloud/storage": "^7.19.0",
@@ -18246,7 +18246,7 @@
},
"packages/cli": {
"name": "@google/gemini-cli",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^0.16.1",
@@ -18394,7 +18394,7 @@
},
"packages/core": {
"name": "@google/gemini-cli-core",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"dependencies": {
"@a2a-js/sdk": "0.3.11",
@@ -18674,7 +18674,7 @@
},
"packages/devtools": {
"name": "@google/gemini-cli-devtools",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"dependencies": {
"ws": "^8.16.0"
@@ -18689,7 +18689,7 @@
},
"packages/sdk": {
"name": "@google/gemini-cli-sdk",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"dependencies": {
"@google/gemini-cli-core": "file:../core",
@@ -18720,7 +18720,7 @@
},
"packages/test-utils": {
"name": "@google/gemini-cli-test-utils",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"dependencies": {
"@google/gemini-cli-core": "file:../core",
@@ -18752,7 +18752,7 @@
},
"packages/vscode-ide-companion": {
"name": "gemini-cli-vscode-ide-companion",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.23.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"engines": {
"node": ">=20.0.0"
},
@@ -14,7 +14,7 @@
"url": "git+https://github.com/google-gemini/gemini-cli.git"
},
"config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.45.0-nightly.20260521.g854f811be"
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.46.0-preview.1"
},
"scripts": {
"start": "cross-env NODE_ENV=development node scripts/start.js",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli-a2a-server",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"description": "Gemini CLI A2A Server",
"repository": {
"type": "git",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"description": "Gemini CLI",
"license": "Apache-2.0",
"repository": {
@@ -27,7 +27,7 @@
"dist"
],
"config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.45.0-nightly.20260521.g854f811be"
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.46.0-preview.1"
},
"dependencies": {
"@agentclientprotocol/sdk": "^0.16.1",
+3
View File
@@ -265,6 +265,7 @@ export function buildAvailableModels(
const preferredModel = config.getModel() || GEMINI_MODEL_ALIAS_AUTO;
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
const selectedAuthType = settings.merged.security.auth.selectedType;
const useCustomToolModel =
useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
@@ -276,6 +277,7 @@ export function buildAvailableModels(
) {
const options = config.getModelConfigService().getAvailableModelOptions({
useGemini3_1: useGemini31,
useGemini3_5Flash,
useCustomTools: useCustomToolModel,
hasAccessToPreview: shouldShowPreviewModels,
});
@@ -294,6 +296,7 @@ export function buildAvailableModels(
description: getAutoModelDescription(
shouldShowPreviewModels,
useGemini31,
useGemini3_5Flash,
),
},
];
+10 -115
View File
@@ -7,7 +7,6 @@
import { AuthType } from '@google/gemini-cli-core';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { validateAuthMethod } from './auth.js';
import fs from 'node:fs';
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual =
@@ -18,30 +17,11 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
};
});
const { mockSettings } = vi.hoisted(() => ({
mockSettings: {
merged: {
security: {
auth: {
byoidConfigPath: undefined as string | undefined,
},
},
experimental: {
byoid: false as boolean,
},
},
},
}));
vi.mock('./settings.js', () => ({
loadEnvironment: vi.fn(),
loadSettings: vi.fn(() => mockSettings),
}));
vi.mock('node:fs', () => ({
default: {
existsSync: vi.fn(),
},
loadSettings: vi.fn().mockReturnValue({
merged: vi.fn().mockReturnValue({}),
}),
}));
describe('validateAuthMethod', () => {
@@ -50,13 +30,10 @@ describe('validateAuthMethod', () => {
vi.stubEnv('GOOGLE_CLOUD_PROJECT', undefined);
vi.stubEnv('GOOGLE_CLOUD_LOCATION', undefined);
vi.stubEnv('GOOGLE_API_KEY', undefined);
mockSettings.merged.security.auth.byoidConfigPath = undefined;
mockSettings.merged.experimental.byoid = false;
});
afterEach(() => {
vi.unstubAllEnvs();
vi.clearAllMocks();
});
it.each([
@@ -115,99 +92,17 @@ describe('validateAuthMethod', () => {
'• GOOGLE_API_KEY environment variable (if using express mode).\n' +
'Update your environment and try again (no reload needed if using .env)!',
},
{
description:
'should return null for BYOID if experimental.byoid is true, and byoidConfigPath is set and exists',
authType: AuthType.BYOID,
envs: {},
byoidEnabled: true,
byoidConfigPath: '/path/to/config',
fsExists: true,
expected: null,
},
{
description:
'should return error for BYOID if experimental.byoid is false',
authType: AuthType.BYOID,
envs: {},
byoidEnabled: false,
expected:
'BYOID authentication is experimental and must be enabled via experimental.byoid in settings.',
},
{
description:
'should return error for BYOID if byoidConfigPath is not set',
authType: AuthType.BYOID,
envs: {},
byoidEnabled: true,
expected:
'When using BYOID, you must specify the security.auth.byoidConfigPath setting.\n' +
'Update your settings and try again!',
},
{
description:
'should return error for BYOID if byoidConfigPath does not exist',
authType: AuthType.BYOID,
envs: {},
byoidEnabled: true,
byoidConfigPath: '/non/existent/path',
fsExists: false,
expected: 'BYOID configuration file not found at: /non/existent/path',
},
{
description:
'should return null for BYOID if experimentalByoid argument is true, even if settings are false',
authType: AuthType.BYOID,
envs: {},
experimentalByoidArg: true,
byoidEnabled: false,
byoidConfigPath: '/path/to/config',
fsExists: true,
expected: null,
},
{
description:
'should return error for BYOID if experimentalByoid argument is false and settings are false',
authType: AuthType.BYOID,
envs: {},
experimentalByoidArg: false,
byoidEnabled: false,
expected:
'BYOID authentication is experimental and must be enabled via experimental.byoid in settings.',
},
{
description: 'should return an error message for an invalid auth method',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
authType: 'invalid' as any,
authType: 'invalid-method' as any,
envs: {},
expected: 'Invalid auth method selected.',
},
])(
'$description',
async ({
authType,
envs,
expected,
byoidConfigPath,
fsExists,
byoidEnabled,
experimentalByoidArg,
}) => {
for (const [key, value] of Object.entries(envs)) {
vi.stubEnv(key, value as string);
}
if (byoidConfigPath !== undefined) {
mockSettings.merged.security.auth.byoidConfigPath = byoidConfigPath;
}
if (byoidEnabled !== undefined) {
mockSettings.merged.experimental.byoid = byoidEnabled;
}
if (fsExists !== undefined) {
vi.mocked(fs.existsSync).mockReturnValue(fsExists);
}
expect(await validateAuthMethod(authType, experimentalByoidArg)).toBe(
expected,
);
},
);
])('$description', async ({ authType, envs, expected }) => {
for (const [key, value] of Object.entries(envs)) {
vi.stubEnv(key, value as string);
}
expect(await validateAuthMethod(authType)).toBe(expected);
});
});
+1 -24
View File
@@ -6,14 +6,11 @@
import { AuthType, loadApiKey } from '@google/gemini-cli-core';
import { loadEnvironment, loadSettings } from './settings.js';
import fs from 'node:fs';
export async function validateAuthMethod(
authMethod: string,
experimentalByoid?: boolean,
): Promise<string | null> {
const settings = loadSettings();
loadEnvironment(settings.merged, process.cwd());
loadEnvironment(loadSettings().merged, process.cwd());
if (
authMethod === AuthType.LOGIN_WITH_GOOGLE ||
authMethod === AuthType.COMPUTE_ADC
@@ -48,25 +45,5 @@ export async function validateAuthMethod(
return null;
}
if (authMethod === AuthType.BYOID) {
const isByoidEnabled =
experimentalByoid || settings.merged.experimental?.byoid;
if (!isByoidEnabled) {
return 'BYOID authentication is experimental and must be enabled via experimental.byoid in settings.';
}
const configPath = settings.merged.security.auth.byoidConfigPath;
if (!configPath) {
return (
'When using BYOID, you must specify the security.auth.byoidConfigPath setting.\n' +
'Update your settings and try again!'
);
}
if (!fs.existsSync(configPath)) {
return `BYOID configuration file not found at: ${configPath}`;
}
return null;
}
return 'Invalid auth method selected.';
}
-7
View File
@@ -91,7 +91,6 @@ export interface CliArgs {
allowedTools: string[] | undefined;
acp?: boolean;
experimentalAcp?: boolean;
experimentalByoid?: boolean;
extensions: string[] | undefined;
listExtensions: boolean | undefined;
resume: string | typeof RESUME_LATEST | undefined;
@@ -369,10 +368,6 @@ export async function parseArguments(
description:
'Starts the agent in ACP mode (deprecated, use --acp instead)',
})
.option('experimental-byoid', {
type: 'boolean',
description: 'Enable experimental support for BYOID authentication',
})
.option('allowed-mcp-server-names', {
type: 'array',
string: true,
@@ -1060,7 +1055,6 @@ export async function loadCliConfig(
disabledSkills: settings.skills?.disabled,
experimentalAutoMemory: settings.experimental?.autoMemory,
experimentalGemma: settings.experimental?.gemma,
experimentalByoid: argv.experimentalByoid || settings.experimental?.byoid,
contextManagement,
modelSteering: settings.experimental?.modelSteering,
topicUpdateNarration:
@@ -1127,7 +1121,6 @@ export async function loadCliConfig(
};
},
enableConseca: settings.security?.enableConseca,
byoidConfigPath: settings.security?.auth?.byoidConfigPath,
});
}
@@ -131,7 +131,6 @@ export class ExtensionManager extends ExtensionLoader {
cwd: options.workspaceDir,
model: '',
debugMode: false,
byoidConfigPath: options.settings.security?.auth?.byoidConfigPath,
});
this.requestConsent = options.requestConsent;
this.requestSetting = options.requestSetting ?? undefined;
-20
View File
@@ -2002,16 +2002,6 @@ const SETTINGS_SCHEMA = {
description: 'Whether to use an external authentication flow.',
showInDialog: false,
},
byoidConfigPath: {
type: 'string',
label: 'BYOID Configuration Path',
category: 'Security',
requiresRestart: true,
default: undefined as string | undefined,
description:
'Path to the BYOID (Bring Your Own IDentifier) configuration file.',
showInDialog: true,
},
},
},
enableConseca: {
@@ -2477,16 +2467,6 @@ const SETTINGS_SCHEMA = {
description: 'Enable logic for context management.',
showInDialog: true,
},
byoid: {
type: 'boolean',
label: 'Enable BYOID Auth',
category: 'Experimental',
requiresRestart: true,
default: false,
description:
'Enable experimental support for BYOID (Bring Your Own IDentifier) authentication.',
showInDialog: true,
},
topicUpdateNarration: {
type: 'boolean',
label: 'Topic & Update Narration',
-1
View File
@@ -516,7 +516,6 @@ export async function main() {
) {
const err = await validateAuthMethod(
settings.merged.security.auth.selectedType,
partialConfig.isExperimentalByoidEnabled(),
);
if (err) {
throw new Error(err);
+1 -5
View File
@@ -912,10 +912,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
const authMethod = settings.merged.security.auth.selectedType;
void (async () => {
try {
const error = await validateAuthMethod(
authMethod,
config.isExperimentalByoidEnabled(),
);
const error = await validateAuthMethod(authMethod);
if (
error &&
authMethod === settings.merged.security.auth.selectedType
@@ -934,7 +931,6 @@ Logging in with Google... Restarting Gemini CLI to continue.
settings.merged.security.auth.enforcedType,
settings.merged.security.auth.useExternal,
onAuthError,
config,
]);
const { isModelDialogOpen, openModelDialog, closeModelDialog } =
+1 -3
View File
@@ -21,7 +21,6 @@ import { validateAuthMethod } from '../../config/auth.js';
export async function validateAuthMethodWithSettings(
authType: AuthType,
settings: LoadedSettings,
config?: Config,
): Promise<string | null> {
const enforcedType = settings.merged.security.auth.enforcedType;
if (enforcedType && enforcedType !== authType) {
@@ -34,7 +33,7 @@ export async function validateAuthMethodWithSettings(
if (authType === AuthType.USE_GEMINI) {
return null;
}
return validateAuthMethod(authType, config?.isExperimentalByoidEnabled());
return validateAuthMethod(authType);
}
import type { AccountSuspensionInfo } from '../contexts/UIStateContext.js';
@@ -115,7 +114,6 @@ export const useAuthCommand = (
const error = await validateAuthMethodWithSettings(
authType,
settings,
config,
).catch((e: unknown) => getErrorMessage(e));
if (error) {
@@ -175,4 +175,45 @@ describe('EditorSettingsDialog', () => {
}
expect(frame).toContain('(Also modified');
});
it('emits error feedback only once when preferredEditor is invalid', async () => {
const mockEmitFeedback = vi.fn();
vi.spyOn(
await import('@google/gemini-cli-core').then((m) => m.coreEvents),
'emitFeedback',
).mockImplementation(mockEmitFeedback);
const invalidSettings = {
forScope: (_scope: string) => ({
settings: {
general: {
preferredEditor: 'invalideditor',
},
},
}),
merged: {
general: {
preferredEditor: 'invalideditor',
},
},
} as unknown as LoadedSettings;
const { unmount } = await renderWithProvider(
<EditorSettingsDialog
onSelect={vi.fn()}
settings={invalidSettings}
onExit={vi.fn()}
/>,
);
await waitFor(() => {
expect(mockEmitFeedback).toHaveBeenCalledWith(
'error',
'Editor is not supported: invalideditor',
);
});
expect(mockEmitFeedback).toHaveBeenCalledTimes(1);
unmount();
});
});
@@ -5,7 +5,7 @@
*/
import type React from 'react';
import { useState } from 'react';
import { useState, useEffect } from 'react';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
import {
@@ -22,6 +22,7 @@ import {
type EditorType,
isEditorAvailable,
EDITOR_DISPLAY_NAMES,
coreEvents,
} from '@google/gemini-cli-core';
import { useKeypress } from '../hooks/useKeypress.js';
@@ -70,10 +71,20 @@ export function EditorSettingsDialog({
(item: EditorDisplay) => item.type === currentPreference,
)
: 0;
if (editorIndex === -1) {
const isUnsupportedEditor = editorIndex === -1;
if (isUnsupportedEditor) {
editorIndex = 0;
}
useEffect(() => {
if (isUnsupportedEditor && currentPreference) {
coreEvents.emitFeedback(
'error',
`Editor is not supported: ${currentPreference}`,
);
}
}, [isUnsupportedEditor, currentPreference]);
const scopeItems: Array<{
label: string;
value: LoadableSettingScope;
@@ -67,6 +67,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
const shouldShowPreviewModels = config?.getHasAccessToPreviewModel() ?? false;
const useGemini31 = config?.getGemini31LaunchedSync?.() ?? false;
const useGemini3_5Flash = config?.hasGemini35FlashGAAccess?.() ?? false;
const selectedAuthType = settings.merged.security.auth.selectedType;
const useCustomToolModel =
useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
@@ -129,6 +130,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
.getModelConfigService()
.getAvailableModelOptions({
useGemini3_1: useGemini31,
useGemini3_5Flash,
useCustomTools: useCustomToolModel,
hasAccessToPreview: shouldShowPreviewModels,
hasAccessToProModel,
@@ -162,6 +164,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
description: getAutoModelDescription(
shouldShowPreviewModels,
useGemini31,
useGemini3_5Flash,
),
key: GEMINI_MODEL_ALIAS_AUTO,
},
@@ -181,6 +184,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
shouldShowPreviewModels,
manualModelSelected,
useGemini31,
useGemini3_5Flash,
useCustomToolModel,
hasAccessToProModel,
]);
@@ -195,6 +199,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
.getModelConfigService()
.getAvailableModelOptions({
useGemini3_1: useGemini31,
useGemini3_5Flash,
useCustomTools: useCustomToolModel,
hasAccessToPreview: shouldShowPreviewModels,
hasAccessToProModel,
@@ -287,6 +292,7 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
}, [
shouldShowPreviewModels,
useGemini31,
useGemini3_5Flash,
useCustomToolModel,
hasAccessToProModel,
config,
@@ -353,6 +353,49 @@ describe('<ModelStatsDisplay />', () => {
unmount();
});
it('should resolve gemini-3-flash to gemini-3.5-flash via getDisplayString', async () => {
const { lastFrame, unmount } = await renderWithMockedStats({
models: {
'gemini-3-flash': {
api: { totalRequests: 1, totalErrors: 0, totalLatencyMs: 100 },
tokens: {
input: 5,
prompt: 10,
candidates: 20,
total: 30,
cached: 5,
thoughts: 2,
tool: 1,
},
roles: {},
},
},
tools: {
totalCalls: 0,
totalSuccess: 0,
totalFail: 0,
totalDurationMs: 0,
totalDecisions: {
accept: 0,
reject: 0,
modify: 0,
[ToolCallDecision.AUTO_ACCEPT]: 0,
},
byName: {},
},
files: {
totalLinesAdded: 0,
totalLinesRemoved: 0,
},
});
const output = lastFrame();
expect(output).toContain('gemini-3.5-flash');
expect(output).not.toContain('gemini-3-flash');
expect(output).toMatchSnapshot();
unmount();
});
it('should handle models with long names (gemini-3-*-preview) without layout breaking', async () => {
const { lastFrame, unmount } = await renderWithMockedStats(
{
@@ -299,7 +299,7 @@ export const ModelStatsDisplay: React.FC<ModelStatsDisplayProps> = ({
},
...modelNames.map((name) => ({
key: name,
header: name,
header: getDisplayString(name),
flexGrow: 1,
renderCell: (row: StatRowData) => {
// Don't render anything for section headers in model columns
@@ -131,6 +131,33 @@ describe('<StatsDisplay />', () => {
expect(output).toMatchSnapshot();
});
it('resolves gemini-3-flash to gemini-3.5-flash in the model usage table', async () => {
const metrics = createTestMetrics({
models: {
'gemini-3-flash': {
api: { totalRequests: 5, totalErrors: 0, totalLatencyMs: 3000 },
tokens: {
input: 1000,
prompt: 2000,
candidates: 3000,
total: 5000,
cached: 500,
thoughts: 100,
tool: 50,
},
roles: {},
},
},
});
const { lastFrame } = await renderWithMockedStats(metrics);
const output = lastFrame();
expect(output).toContain('gemini-3.5-flash');
expect(output).not.toContain('gemini-3-flash\u0020'); // Avoid matching parts of substrings if not intended
expect(output).toMatchSnapshot();
});
it('renders role breakdown correctly under models', async () => {
const metrics = createTestMetrics({
models: {
@@ -24,7 +24,7 @@ import {
import { computeSessionStats } from '../utils/computeStats.js';
import { useSettings } from '../contexts/SettingsContext.js';
import type { QuotaStats } from '../types.js';
import { LlmRole } from '@google/gemini-cli-core';
import { LlmRole, getDisplayString } from '@google/gemini-cli-core';
// A more flexible and powerful StatRow component
interface StatRowProps {
@@ -101,7 +101,7 @@ const ModelUsageTable: React.FC<ModelUsageTableProps> = ({ models }) => {
Object.entries(models).forEach(([name, metrics]) => {
rows.push({
name,
displayName: name,
displayName: getDisplayString(name),
requests: metrics.api.totalRequests,
cachedTokens: metrics.tokens.cached.toLocaleString(),
inputTokens: metrics.tokens.prompt.toLocaleString(),
@@ -60,12 +60,6 @@ exports[`InputPrompt > Highlighting and Cursor Display > single-line scenarios >
────────────────────────────────────────────────────────────────────────────────────────────────────"
`;
exports[`InputPrompt > Highlighting and Cursor Display > single-line scenarios > should display cursor correctly 'at the end of the line' 2`] = `
"────────────────────────────────────────────────────────────────────────────────────────────────────
> hello
────────────────────────────────────────────────────────────────────────────────────────────────────"
`;
exports[`InputPrompt > Highlighting and Cursor Display > single-line scenarios > should display cursor correctly 'for multi-byte unicode characters' 1`] = `
"────────────────────────────────────────────────────────────────────────────────────────────────────
> hello 👍 world
@@ -215,3 +215,26 @@ exports[`<ModelStatsDisplay /> > should render "no API calls" message when there
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
exports[`<ModelStatsDisplay /> > should resolve gemini-3-flash to gemini-3.5-flash via getDisplayString 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Model Stats For Nerds │
│ │
│ │
│ Metric gemini-3.5-flash │
│ ────────────────────────────────────────────────────────────────────────────────────────────── │
│ API │
│ Requests 1 │
│ Errors 0 (0.0%) │
│ Avg Latency 100ms │
│ Tokens │
│ Total 30 │
│ ↳ Input 5 │
│ ↳ Cache Reads 5 (50.0%) │
│ ↳ Thoughts 2 │
│ ↳ Tool 1 │
│ ↳ Output 20 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
@@ -292,3 +292,30 @@ exports[`<StatsDisplay /> > renders role breakdown correctly under models 1`] =
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
exports[`<StatsDisplay /> > resolves gemini-3-flash to gemini-3.5-flash in the model usage table 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Session Stats │
│ │
│ Interaction Summary │
│ Session ID: test-session-id │
│ Tool Calls: 0 ( ✓ 0 x 0 ) │
│ Success Rate: 0.0% │
│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 3.0s │
│ » API Time: 3.0s (100.0%) │
│ » Tool Time: 0s (0.0%) │
│ │
│ │
│ Model Usage │
│ Use /model to view model quota information │
│ │
│ Model Reqs Input Tokens Cache Reads Output Tokens │
│ ────────────────────────────────────────────────────────────────────────────────────────────── │
│ gemini-3.5-flash 5 2,000 500 3,000 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
@@ -134,4 +134,5 @@ export const WITTY_LOADING_PHRASES = [
'Constructing additional pylons',
'New line? Thats Ctrl+J.',
'Releasing the HypnoDrones',
'Pushing the button, Frank.',
];
@@ -42,10 +42,7 @@ export async function validateNonInteractiveAuth(
const authType: AuthType = effectiveAuthType;
if (!useExternalAuth) {
const err = await validateAuthMethod(
String(authType),
nonInteractiveConfig.isExperimentalByoidEnabled(),
);
const err = await validateAuthMethod(String(authType));
if (err != null) {
throw new Error(err);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli-core",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"description": "Gemini CLI Core",
"license": "Apache-2.0",
"repository": {
@@ -33,6 +33,7 @@ export interface ModelPolicyOptions {
useGemini31?: boolean;
useGemini31FlashLite?: boolean;
useCustomToolModel?: boolean;
useGemini3_5Flash?: boolean;
}
const DEFAULT_ACTIONS: ModelPolicyActionMap = {
@@ -94,6 +95,9 @@ export function getModelPolicyChain(
PREVIEW_GEMINI_MODEL,
options.useGemini31,
options.useCustomToolModel,
true,
undefined,
options.useGemini3_5Flash,
);
return [
definePolicy({
@@ -54,6 +54,7 @@ export function resolvePolicyChain(
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
const useCustomToolModel = config.getUseCustomToolModelSync?.() ?? false;
const hasAccessToPreview = config.getHasAccessToPreviewModel?.() ?? false;
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
// Capture the original family intent before any normalization or early downgrade.
const isOriginallyGemini3 = isGemini3Model(modelFromConfig, config);
@@ -65,6 +66,7 @@ export function resolvePolicyChain(
useCustomToolModel,
hasAccessToPreview,
config,
useGemini3_5Flash,
),
);
const isAutoPreferred = normalizedPreferredModel
@@ -82,6 +84,7 @@ export function resolvePolicyChain(
const context = {
useGemini3_1: useGemini31,
useCustomTools: useCustomToolModel,
useGemini3_5Flash,
};
if (resolvedModel === DEFAULT_GEMINI_FLASH_LITE_MODEL) {
@@ -136,6 +139,7 @@ export function resolvePolicyChain(
userTier: config.getUserTier(),
useGemini31,
useCustomToolModel,
useGemini3_5Flash,
});
} else {
// User requested Gemini 3 but has no access. Proactively downgrade
@@ -146,6 +150,7 @@ export function resolvePolicyChain(
userTier: config.getUserTier(),
useGemini31,
useCustomToolModel,
useGemini3_5Flash,
});
}
} else {
+1 -2
View File
@@ -19,8 +19,7 @@ export async function createCodeAssistContentGenerator(
): Promise<ContentGenerator> {
if (
authType === AuthType.LOGIN_WITH_GOOGLE ||
authType === AuthType.COMPUTE_ADC ||
authType === AuthType.BYOID
authType === AuthType.COMPUTE_ADC
) {
const authClient = await getOauthClient(authType, config);
const userData = await setupUser(authClient, config, httpOptions);
@@ -19,6 +19,7 @@ export const ExperimentFlags = {
GEMINI_3_1_PRO_LAUNCHED: 45760185,
PRO_MODEL_NO_ACCESS: 45768879,
DEFAULT_REQUEST_TIMEOUT: 45773134,
GEMINI_3_5_FLASH_GA_LAUNCHED: 45780819,
} as const;
export type ExperimentFlagName =
+55
View File
@@ -69,6 +69,7 @@ import {
DEFAULT_GEMINI_MODEL_AUTO,
PREVIEW_GEMINI_MODEL_AUTO,
PREVIEW_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
} from './models.js';
import { Storage } from './storage.js';
import type { AgentLoopContext } from './agent-loop-context.js';
@@ -4346,3 +4347,57 @@ describe('ADKSettings', () => {
expect(config.getAgentSessionNoninteractiveEnabled()).toBe(true);
});
});
describe('hasGemini35FlashGAAccess model setting', () => {
const baseParams: ConfigParameters = {
sessionId: 'test',
targetDir: '.',
debugMode: false,
model: 'test-model',
cwd: '.',
};
it('should set DEFAULT_GEMINI_FLASH_MODEL to gemini-3.5-flash and PREVIEW_GEMINI_FLASH_MODEL to gemini-3-flash-preview if hasGemini35FlashGAAccess returns true and authType is USE_GEMINI', () => {
const config = new Config(baseParams);
config['contentGeneratorConfig'] = { authType: AuthType.USE_GEMINI };
// Set experiment to return true for GEMINI_3_5_FLASH_GA_LAUNCHED
config.setExperiments({
experimentIds: [],
flags: {
[ExperimentFlags.GEMINI_3_5_FLASH_GA_LAUNCHED]: {
boolValue: true,
},
},
});
// Call the method
const result = config.hasGemini35FlashGAAccess();
expect(result).toBe(true);
expect(DEFAULT_GEMINI_FLASH_MODEL).toBe('gemini-3.5-flash');
expect(PREVIEW_GEMINI_FLASH_MODEL).toBe('gemini-3-flash-preview');
});
it('should set DEFAULT_GEMINI_FLASH_MODEL and PREVIEW_GEMINI_FLASH_MODEL to gemini-3-flash if hasGemini35FlashGAAccess returns true and authType is not USE_GEMINI', () => {
const config = new Config(baseParams);
config['contentGeneratorConfig'] = { authType: AuthType.LOGIN_WITH_GOOGLE };
// Set experiment to return true for GEMINI_3_5_FLASH_GA_LAUNCHED
config.setExperiments({
experimentIds: [],
flags: {
[ExperimentFlags.GEMINI_3_5_FLASH_GA_LAUNCHED]: {
boolValue: true,
},
},
});
// Call the method
const result = config.hasGemini35FlashGAAccess();
expect(result).toBe(true);
expect(DEFAULT_GEMINI_FLASH_MODEL).toBe('gemini-3-flash');
expect(PREVIEW_GEMINI_FLASH_MODEL).toBe('gemini-3-flash');
});
});
+37 -18
View File
@@ -86,6 +86,7 @@ import {
isGemini2Model,
PREVIEW_GEMINI_FLASH_MODEL,
resolveModel,
setFlashModels,
} from './models.js';
import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
import type { MCPOAuthConfig } from '../mcp/oauth-provider.js';
@@ -715,7 +716,6 @@ export interface ConfigParameters {
autoDistillation?: boolean;
experimentalAutoMemory?: boolean;
experimentalGemma?: boolean;
experimentalByoid?: boolean;
experimentalContextManagementConfig?: string;
experimentalAgentHistoryTruncation?: boolean;
experimentalAgentHistoryTruncationThreshold?: number;
@@ -745,7 +745,6 @@ export interface ConfigParameters {
};
vertexAiRouting?: VertexAiRoutingConfig;
logRagSnippets?: boolean;
byoidConfigPath?: string;
}
export class Config implements McpContext, AgentLoopContext {
@@ -958,7 +957,6 @@ export class Config implements McpContext, AgentLoopContext {
overageStrategy: OverageStrategy;
};
private readonly vertexAiRouting: VertexAiRoutingConfig | undefined;
private readonly byoidConfigPath: string | undefined;
private readonly enableAgents: boolean;
private agents: AgentSettings;
@@ -968,7 +966,6 @@ export class Config implements McpContext, AgentLoopContext {
private readonly adminSkillsEnabled: boolean;
private readonly experimentalAutoMemory: boolean;
private readonly experimentalGemma: boolean;
private readonly experimentalByoid: boolean;
private readonly experimentalContextManagementConfig?: string;
private readonly memoryBoundaryMarkers: readonly string[];
private readonly topicUpdateNarration: boolean;
@@ -1190,7 +1187,6 @@ export class Config implements McpContext, AgentLoopContext {
this.experimentalAutoMemory = params.experimentalAutoMemory ?? false;
this.experimentalGemma = params.experimentalGemma ?? true;
this.experimentalByoid = params.experimentalByoid ?? false;
this.experimentalContextManagementConfig =
params.experimentalContextManagementConfig;
this.memoryBoundaryMarkers = params.memoryBoundaryMarkers ?? ['.git'];
@@ -1603,7 +1599,6 @@ export class Config implements McpContext, AgentLoopContext {
baseUrl,
customHeaders,
this.vertexAiRouting,
this.byoidConfigPath,
);
this.contentGenerator = await createContentGenerator(
newContentGeneratorConfig,
@@ -2060,6 +2055,7 @@ export class Config implements McpContext, AgentLoopContext {
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
this.hasGemini35FlashGAAccess(),
);
const isPreview = isPreviewModel(primaryModel, this);
@@ -2099,6 +2095,7 @@ export class Config implements McpContext, AgentLoopContext {
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
this.hasGemini35FlashGAAccess(),
);
return this.modelQuotas.get(primaryModel)?.remaining;
}
@@ -2114,6 +2111,7 @@ export class Config implements McpContext, AgentLoopContext {
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
this.hasGemini35FlashGAAccess(),
);
return this.modelQuotas.get(primaryModel)?.limit;
}
@@ -2129,6 +2127,7 @@ export class Config implements McpContext, AgentLoopContext {
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
this.hasGemini35FlashGAAccess(),
);
return this.modelQuotas.get(primaryModel)?.resetTime;
}
@@ -2658,10 +2657,6 @@ export class Config implements McpContext, AgentLoopContext {
return this.modelSteering;
}
isExperimentalByoidEnabled(): boolean {
return this.experimentalByoid;
}
async getToolOutputMaskingConfig(): Promise<ToolOutputMaskingConfig> {
await this.ensureExperimentsLoaded();
@@ -3547,6 +3542,38 @@ export class Config implements McpContext, AgentLoopContext {
);
}
/**
* Returns whether Gemini 3.5 Flash GA has been launched.
*
* Note: This method should only be called after startup, once experiments have been loaded.
*/
hasGemini35FlashGAAccess(): boolean {
const authType = this.contentGeneratorConfig?.authType;
const hasAccess = (() => {
if (this.isGemini31LaunchedForAuthType(authType)) {
return true;
}
return (
this.experiments?.flags[ExperimentFlags.GEMINI_3_5_FLASH_GA_LAUNCHED]
?.boolValue ?? false
);
})();
// Used to set default flash models based on access
// TODO: Remove once the experiment for 3_5 flash rollut can be cleaned up.
if (hasAccess) {
// Gemini API key users should have the ability to manually select the
// old preview flash model.
if (authType === AuthType.USE_GEMINI) {
setFlashModels('gemini-3-flash-preview', 'gemini-3.5-flash');
} else {
setFlashModels('gemini-3-flash', 'gemini-3-flash');
}
} else {
setFlashModels('gemini-3-flash-preview', 'gemini-2.5-flash');
}
return hasAccess;
}
/**
* Returns whether Gemini 3.1 has been launched.
*
@@ -4146,14 +4173,6 @@ export class Config implements McpContext, AgentLoopContext {
await this.mcpClientManager.stop();
}
}
isExperimentalByoidEnabled(): boolean {
return this.experimentalByoid;
}
getByoidConfigPath(): string | undefined {
return this.byoidConfigPath;
}
}
// Export model constants for use in CLI
export { DEFAULT_GEMINI_FLASH_MODEL };
@@ -113,6 +113,12 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
model: 'gemini-3.1-flash-lite',
},
},
'gemini-3.5-flash': {
extends: 'chat-base-3',
modelConfig: {
model: 'gemini-3.5-flash',
},
},
'gemma-4-31b-it': {
extends: 'chat-base-3',
modelConfig: {
@@ -139,6 +145,12 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
model: 'gemini-3-flash-preview',
},
},
'gemini-3.5-flash-base': {
extends: 'base',
modelConfig: {
model: 'gemini-3.5-flash',
},
},
classifier: {
extends: 'base',
modelConfig: {
@@ -346,6 +358,13 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
isVisible: true,
features: { thinking: false, multimodalToolUse: true },
},
'gemini-3.5-flash': {
tier: 'flash',
family: 'gemini-3',
isPreview: false,
isVisible: true,
features: { thinking: false, multimodalToolUse: true },
},
'gemini-2.5-pro': {
tier: 'pro',
family: 'gemini-2.5',
@@ -451,11 +470,34 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
default: 'gemini-3-flash-preview',
contexts: [
{
condition: { hasAccessToPreview: false },
condition: { hasAccessToPreview: false, useGemini3_5Flash: true },
target: 'gemini-3.5-flash',
},
{
condition: { hasAccessToPreview: false, useGemini3_5Flash: false },
target: 'gemini-2.5-flash',
},
],
},
'gemini-3.5-flash': {
default: 'gemini-3.5-flash',
contexts: [
{
condition: { useGemini3_5Flash: false, hasAccessToPreview: false },
target: 'gemini-2.5-flash',
},
{
condition: { useGemini3_5Flash: false },
target: 'gemini-3-flash-preview',
},
],
},
'gemini-2.5-flash': {
default: 'gemini-2.5-flash',
contexts: [
{ condition: { useGemini3_5Flash: true }, target: 'gemini-3.5-flash' },
],
},
'gemini-3-pro-preview': {
default: 'gemini-3-pro-preview',
contexts: [
@@ -504,6 +546,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
flash: {
default: 'gemini-3-flash-preview',
contexts: [
{ condition: { useGemini3_5Flash: true }, target: 'gemini-3.5-flash' },
{
condition: { hasAccessToPreview: false },
target: 'gemini-2.5-flash',
@@ -535,6 +578,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
flash: {
default: 'gemini-3-flash-preview',
contexts: [
{ condition: { useGemini3_5Flash: true }, target: 'gemini-3.5-flash' },
{
condition: { hasAccessToPreview: false },
target: 'gemini-2.5-flash',
+305
View File
@@ -17,6 +17,7 @@ import {
DEFAULT_GEMINI_MODEL,
PREVIEW_GEMINI_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_3_5_FLASH_MODEL,
DEFAULT_GEMINI_FLASH_LITE_MODEL,
supportsMultimodalFunctionResponse,
GEMINI_MODEL_ALIAS_PRO,
@@ -744,4 +745,308 @@ describe('getAutoModelDescription', () => {
expect(desc).toContain('gemini-3.1-pro-preview');
expect(desc).toContain('gemini-3-flash-preview');
});
it('should return Gemini 3.5 Flash description when hasAccessToPreview and useGemini3_5Flash are true', () => {
const desc = getAutoModelDescription(true, true, true);
expect(desc).toContain('gemini-3.1-pro-preview');
expect(desc).toContain(DEFAULT_GEMINI_3_5_FLASH_MODEL);
});
});
describe('resolveModel Gemini 3.5 Flash GA', () => {
it('should resolve all but preview flash models to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (legacy)', () => {
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
expect(
resolveModel(
DEFAULT_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
true,
),
).toBe(PREVIEW_GEMINI_FLASH_MODEL);
});
it('should resolve all but preview flash models to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
expect(
resolveModel(
DEFAULT_GEMINI_FLASH_MODEL,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe(PREVIEW_GEMINI_FLASH_MODEL);
});
it('should NOT resolve flash models to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is false', () => {
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
false,
),
).toBe(PREVIEW_GEMINI_FLASH_MODEL);
expect(
resolveModel(
DEFAULT_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
false,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
false,
),
).toBe(PREVIEW_GEMINI_FLASH_MODEL);
});
it('should resolve to DEFAULT_GEMINI_FLASH_MODEL when GA is false AND preview access is false (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveModel(
DEFAULT_GEMINI_FLASH_MODEL,
false,
false,
false, // No preview access
mockDynamicConfig,
false, // GA false
),
).toBe('gemini-2.5-flash');
});
it('should resolve auto to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true and classifier selects flash', () => {
expect(
resolveClassifierModel(
GEMINI_MODEL_ALIAS_AUTO,
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
it('should resolve auto to gemini-3.5-flash when useGemini3_5Flash is true and classifier selects flash (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveClassifierModel(
GEMINI_MODEL_ALIAS_AUTO,
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
});
describe('Flash model promotion and manual override routing logic', () => {
it('should resolve flash alias to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (static)', () => {
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
it('should resolve flash alias to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
});
it('should resolve manual selection of gemini-3-flash-preview to gemini-3-flash-preview when useGemini3_5Flash is true and has preview access (static)', () => {
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
true,
),
).toBe('gemini-3-flash-preview');
});
it('should resolve manual selection of gemini-3-flash-preview to gemini-3-flash-preview when useGemini3_5Flash is true and has preview access (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3-flash-preview');
});
it('should resolve manual selection of gemini-3-flash-preview to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true but lacks preview access (static)', () => {
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
false,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
it('should resolve manual selection of gemini-3-flash-preview to gemini-3.5-flash when useGemini3_5Flash is true but lacks preview access (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
false,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
});
it('should resolve classifier-selected flash alias to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (static)', () => {
expect(
resolveClassifierModel(
GEMINI_MODEL_ALIAS_AUTO,
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
it('should resolve classifier-selected flash alias to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
const mockDynamicConfig = {
getExperimentalDynamicModelConfiguration: () => true,
modelConfigService,
} as unknown as Config;
expect(
resolveClassifierModel(
GEMINI_MODEL_ALIAS_AUTO,
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
mockDynamicConfig,
true,
),
).toBe('gemini-3.5-flash');
});
it('should resolve auto to PREVIEW_GEMINI_MODEL when useGemini3_5Flash is true and has preview access', () => {
expect(
resolveModel(
GEMINI_MODEL_ALIAS_AUTO,
false,
false,
true, // hasAccessToPreview
undefined,
true, // useGemini3_5Flash
),
).toBe(PREVIEW_GEMINI_MODEL);
});
});
});
+65 -5
View File
@@ -6,6 +6,7 @@
export interface ModelResolutionContext {
useGemini3_1?: boolean;
useGemini3_5Flash?: boolean;
useCustomTools?: boolean;
hasAccessToPreview?: boolean;
requestedModel?: string;
@@ -54,9 +55,29 @@ export const PREVIEW_GEMINI_MODEL = 'gemini-3-pro-preview';
export const PREVIEW_GEMINI_3_1_MODEL = 'gemini-3.1-pro-preview';
export const PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL =
'gemini-3.1-pro-preview-customtools';
export const PREVIEW_GEMINI_FLASH_MODEL = 'gemini-3-flash-preview';
// TODO: set to none and const once the experiment for 3_5 flash rollut can be
// cleaned up.
export let PREVIEW_GEMINI_FLASH_MODEL = 'gemini-3-flash-preview';
export const DEFAULT_GEMINI_MODEL = 'gemini-2.5-pro';
export const DEFAULT_GEMINI_FLASH_MODEL = 'gemini-2.5-flash';
// TODO: Set to const and update to 'gemini-3.5-flash' once the experiment for
// 3_5 flash rollut can be cleaned up.
// This is set to either the same as the DEFAULT_GEMINI_3_5_FLASH_MODEL const
// OR the SECONDARY_GEMINI_3_5_FLASH_MODEL depending on which is needed for
// the user's backend as determined by hasGemini35FlashGAAccess in
// packages/core/src/config/config.ts
export let DEFAULT_GEMINI_FLASH_MODEL = 'gemini-2.5-flash';
export const DEFAULT_GEMINI_3_5_FLASH_MODEL = 'gemini-3.5-flash';
// This is resolved to 3.5 flash in backends where it is used,
// however those backends do not expect to see the string gemini-3.5-flash
// so we need to provide this model as an alternative name in certain instances.
export const SECONDARY_GEMINI_3_5_FLASH_MODEL = 'gemini-3-flash';
// Used to set default flash models based on access
// TODO: Cleanup once the experiment for 3_5 flash rollut can be cleaned up.
export function setFlashModels(preview: string, defaultFlash: string) {
PREVIEW_GEMINI_FLASH_MODEL = preview;
DEFAULT_GEMINI_FLASH_MODEL = defaultFlash;
}
export const DEFAULT_GEMINI_FLASH_LITE_MODEL = 'gemini-3.1-flash-lite';
/** @deprecated Gemini 3.1 Flash Lite is now GA. Use DEFAULT_GEMINI_FLASH_LITE_MODEL. */
export const PREVIEW_GEMINI_FLASH_LITE_MODEL = 'none';
@@ -72,6 +93,8 @@ export const VALID_GEMINI_MODELS = new Set([
PREVIEW_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_3_5_FLASH_MODEL,
SECONDARY_GEMINI_3_5_FLASH_MODEL,
DEFAULT_GEMINI_FLASH_LITE_MODEL,
GEMMA_4_31B_IT_MODEL,
@@ -97,6 +120,7 @@ export const DEFAULT_THINKING_MODE = 8192;
export function getAutoModelDescription(
hasAccessToPreview: boolean,
useGemini3_1: boolean = false,
useGemini3_5Flash: boolean = false,
) {
const proModel = hasAccessToPreview
? useGemini3_1
@@ -104,9 +128,11 @@ export function getAutoModelDescription(
: PREVIEW_GEMINI_MODEL
: DEFAULT_GEMINI_MODEL;
const flashModel = hasAccessToPreview
? PREVIEW_GEMINI_FLASH_MODEL
? useGemini3_5Flash
? DEFAULT_GEMINI_3_5_FLASH_MODEL
: PREVIEW_GEMINI_FLASH_MODEL
: DEFAULT_GEMINI_FLASH_MODEL;
return `Let Gemini CLI decide the best model for the task: ${proModel}, ${flashModel}`;
return `Let Gemini CLI decide the best model for the task: ${getDisplayString(proModel)}, ${getDisplayString(flashModel)}`;
}
/**
@@ -115,6 +141,7 @@ export function getAutoModelDescription(
*
* @param requestedModel The model alias or concrete model name requested by the user.
* @param useGemini3_1 Whether to use Gemini 3.1 Pro Preview for auto/pro aliases.
* @param useGemini3_5Flash Whether to use Gemini 3.5 Flash GA.
* @param hasAccessToPreview Whether the user has access to preview models.
* @returns The resolved concrete model name.
*/
@@ -124,6 +151,7 @@ export function resolveModel(
useCustomToolModel: boolean = false,
hasAccessToPreview: boolean = true,
config?: ModelCapabilityContext,
useGemini3_5Flash: boolean = false,
): string {
// Defensive check against non-string inputs at runtime
const normalizedModel = Array.isArray(requestedModel)
@@ -137,6 +165,7 @@ export function resolveModel(
useGemini3_1,
useCustomTools: useCustomToolModel,
hasAccessToPreview,
useGemini3_5Flash,
});
if (!hasAccessToPreview && isPreviewModel(resolved, config)) {
@@ -179,7 +208,9 @@ export function resolveModel(
break;
}
case GEMINI_MODEL_ALIAS_FLASH: {
resolved = PREVIEW_GEMINI_FLASH_MODEL;
resolved = useGemini3_5Flash
? DEFAULT_GEMINI_FLASH_MODEL
: PREVIEW_GEMINI_FLASH_MODEL;
break;
}
case GEMINI_MODEL_ALIAS_FLASH_LITE: {
@@ -196,6 +227,14 @@ export function resolveModel(
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
}
if (
useGemini3_5Flash &&
isFlashModel(resolved) &&
normalizedModel !== PREVIEW_GEMINI_FLASH_MODEL
) {
return DEFAULT_GEMINI_FLASH_MODEL;
}
if (!hasAccessToPreview && isPreviewModel(resolved)) {
// Downgrade to stable models if user lacks preview access.
switch (resolved) {
@@ -220,6 +259,17 @@ export function resolveModel(
return resolved;
}
function isFlashModel(model: string): boolean {
return (
model === DEFAULT_GEMINI_FLASH_MODEL ||
model === PREVIEW_GEMINI_FLASH_MODEL ||
model === DEFAULT_GEMINI_3_5_FLASH_MODEL ||
model === SECONDARY_GEMINI_3_5_FLASH_MODEL ||
model === 'flash' ||
model.endsWith('flash')
);
}
/**
* Resolves the appropriate model based on the classifier's decision.
*
@@ -237,6 +287,7 @@ export function resolveClassifierModel(
useCustomToolModel: boolean = false,
hasAccessToPreview: boolean = true,
config?: ModelCapabilityContext,
useGemini3_5Flash: boolean = false,
): string {
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
return config.modelConfigService.resolveClassifierModelId(
@@ -246,6 +297,7 @@ export function resolveClassifierModel(
useGemini3_1,
useCustomTools: useCustomToolModel,
hasAccessToPreview,
useGemini3_5Flash,
},
);
}
@@ -262,6 +314,9 @@ export function resolveClassifierModel(
requestedModel === PREVIEW_GEMINI_MODEL ||
requestedModel === GEMINI_MODEL_ALIAS_AUTO
) {
if (useGemini3_5Flash) {
return DEFAULT_GEMINI_FLASH_MODEL;
}
return hasAccessToPreview
? PREVIEW_GEMINI_FLASH_MODEL
: DEFAULT_GEMINI_FLASH_MODEL;
@@ -271,6 +326,8 @@ export function resolveClassifierModel(
false,
false,
hasAccessToPreview,
config,
useGemini3_5Flash,
);
}
return resolveModel(
@@ -279,6 +336,7 @@ export function resolveClassifierModel(
useCustomToolModel,
hasAccessToPreview,
config,
useGemini3_5Flash,
);
}
@@ -294,6 +352,8 @@ export function getDisplayString(
}
switch (model) {
case 'gemini-3-flash':
return DEFAULT_GEMINI_3_5_FLASH_MODEL;
case GEMINI_MODEL_ALIAS_AUTO:
return 'Auto';
case PREVIEW_GEMINI_MODEL_AUTO:
+1
View File
@@ -607,6 +607,7 @@ export class GeminiClient {
false,
this.config.getHasAccessToPreviewModel?.() ?? true,
this.config,
this.config.hasGemini35FlashGAAccess?.() ?? false,
);
}
+3 -16
View File
@@ -65,7 +65,6 @@ export enum AuthType {
LEGACY_CLOUD_SHELL = 'cloud-shell',
COMPUTE_ADC = 'compute-default-credentials',
GATEWAY = 'gateway',
BYOID = 'byoid',
}
/**
@@ -106,7 +105,6 @@ export type ContentGeneratorConfig = {
baseUrl?: string;
customHeaders?: Record<string, string>;
vertexAiRouting?: VertexAiRoutingConfig;
byoidConfigPath?: string;
};
export type VertexAiRequestType = 'dedicated' | 'shared';
@@ -136,7 +134,6 @@ export async function createContentGeneratorConfig(
baseUrl?: string,
customHeaders?: Record<string, string>,
vertexAiRouting?: VertexAiRoutingConfig,
byoidConfigPath?: string,
): Promise<ContentGeneratorConfig> {
const contentGeneratorConfig: ContentGeneratorConfig = {
authType,
@@ -144,7 +141,6 @@ export async function createContentGeneratorConfig(
baseUrl,
customHeaders,
vertexAiRouting,
byoidConfigPath,
};
// If we are using Google auth or we are in Cloud Shell, there is nothing else to validate for now.
@@ -152,8 +148,7 @@ export async function createContentGeneratorConfig(
// (WSL/SSH/Docker/CI) keytar can block indefinitely on its functional probe.
if (
authType === AuthType.LOGIN_WITH_GOOGLE ||
authType === AuthType.COMPUTE_ADC ||
authType === AuthType.BYOID
authType === AuthType.COMPUTE_ADC
) {
return contentGeneratorConfig;
}
@@ -226,6 +221,7 @@ export async function createContentGenerator(
false,
gcConfig.getHasAccessToPreviewModel?.() ?? true,
gcConfig,
gcConfig.hasGemini35FlashGAAccess?.() ?? false,
);
const customHeadersEnv =
process.env['GEMINI_CLI_CUSTOM_HEADERS'] || undefined;
@@ -282,17 +278,8 @@ export async function createContentGenerator(
}
if (
config.authType === AuthType.LOGIN_WITH_GOOGLE ||
config.authType === AuthType.COMPUTE_ADC ||
config.authType === AuthType.BYOID
config.authType === AuthType.COMPUTE_ADC
) {
if (
config.authType === AuthType.BYOID &&
!gcConfig.isExperimentalByoidEnabled()
) {
throw new Error(
'BYOID authentication is experimental and must be enabled via the experimentalByoid flag.',
);
}
const httpOptions = { headers: baseHeaders };
return new LoggingContentGenerator(
await createCodeAssistContentGenerator(
@@ -159,6 +159,7 @@ describe('GeminiChat', () => {
getTelemetryLogPromptsEnabled: () => true,
getTelemetryTracesEnabled: () => false,
getUsageStatisticsEnabled: () => true,
hasGemini35FlashGAAccess: vi.fn().mockReturnValue(false),
getDebugMode: () => false,
getContentGeneratorConfig: vi.fn().mockImplementation(() => ({
authType: 'oauth-personal',
+3 -1
View File
@@ -721,7 +721,6 @@ export class GeminiChat {
(await this.context.config.getGemini31Launched?.()) ?? false;
const hasAccessToPreview =
this.context.config.getHasAccessToPreviewModel?.() ?? true;
// Default to the last used model (which respects arguments/availability selection)
let modelToUse = resolveModel(
lastModelToUse,
@@ -729,6 +728,7 @@ export class GeminiChat {
false,
hasAccessToPreview,
this.context.config,
this.context.config.hasGemini35FlashGAAccess?.() ?? false,
);
// If the active model has changed (e.g. due to a fallback updating the config),
@@ -740,6 +740,7 @@ export class GeminiChat {
false,
hasAccessToPreview,
this.context.config,
this.context.config.hasGemini35FlashGAAccess?.() ?? false,
);
}
@@ -802,6 +803,7 @@ export class GeminiChat {
false,
hasAccessToPreview,
this.context.config,
this.context.config.hasGemini35FlashGAAccess?.() ?? false,
);
lastModelToUse = modelToUse;
// Re-evaluate contentsToUse based on the new model's feature support
@@ -98,6 +98,7 @@ describe('GeminiChat Network Retries', () => {
getTelemetryLogPromptsEnabled: () => true,
getTelemetryTracesEnabled: () => false,
getUsageStatisticsEnabled: () => true,
hasGemini35FlashGAAccess: vi.fn().mockReturnValue(false),
getDebugMode: () => false,
getContentGeneratorConfig: vi.fn().mockReturnValue({
authType: 'oauth-personal',
@@ -76,6 +76,7 @@ export class PromptProvider {
false,
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
context.config.hasGemini35FlashGAAccess?.() ?? false,
);
const isModernModel = supportsModernFeatures(desiredModel);
const activeSnippets = isModernModel ? snippets : legacySnippets;
@@ -299,6 +300,7 @@ export class PromptProvider {
false,
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
context.config.hasGemini35FlashGAAccess?.() ?? false,
);
const isModernModel = supportsModernFeatures(desiredModel);
const activeSnippets = isModernModel ? snippets : legacySnippets;
@@ -242,4 +242,22 @@ describe('ApprovalModeStrategy', () => {
// Should resolve to Preview Flash (3.0) because resolveClassifierModel uses preview variants for Gemini 3
expect(decision?.model).toBe(PREVIEW_GEMINI_FLASH_MODEL);
});
it('should route to DEFAULT_GEMINI_FLASH_MODEL when hasGemini35FlashGAAccess is true and plan is approved', async () => {
vi.mocked(mockConfig.getModel).mockReturnValue(GEMINI_MODEL_ALIAS_AUTO);
mockConfig.hasGemini35FlashGAAccess = vi.fn().mockReturnValue(true);
vi.mocked(mockConfig.getApprovalMode).mockReturnValue(ApprovalMode.DEFAULT);
vi.mocked(mockConfig.getApprovedPlanPath).mockReturnValue(
'/path/to/plan.md',
);
const decision = await strategy.route(
mockContext,
mockConfig,
mockBaseLlmClient,
);
expect(decision?.model).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
});
@@ -54,6 +54,7 @@ export class ApprovalModeStrategy implements RoutingStrategy {
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
// 1. Planning Phase: If ApprovalMode === PLAN, explicitly route to the Pro model.
if (approvalMode === ApprovalMode.PLAN) {
@@ -64,6 +65,7 @@ export class ApprovalModeStrategy implements RoutingStrategy {
useCustomToolModel,
hasAccessToPreview,
config,
useGemini3_5Flash,
);
return {
model: proModel,
@@ -82,6 +84,7 @@ export class ApprovalModeStrategy implements RoutingStrategy {
useCustomToolModel,
hasAccessToPreview,
config,
useGemini3_5Flash,
);
return {
model: flashModel,
@@ -522,5 +522,27 @@ describe('ClassifierStrategy', () => {
expect(decision?.model).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
});
it('should route to DEFAULT_GEMINI_FLASH_MODEL when hasGemini35FlashGAAccess is true', async () => {
mockConfig.hasGemini35FlashGAAccess = vi.fn().mockReturnValue(true);
vi.mocked(mockConfig.getModel).mockReturnValue(PREVIEW_GEMINI_MODEL_AUTO);
const mockApiResponse = {
reasoning: 'Simple task',
model_choice: 'flash',
};
vi.mocked(mockBaseLlmClient.generateJson).mockResolvedValue(
mockApiResponse,
);
const decision = await strategy.route(
mockContext,
mockConfig,
mockBaseLlmClient,
mockLocalLiteRtLmClient,
);
expect(decision?.model).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
});
});
@@ -186,6 +186,7 @@ export class ClassifierStrategy implements RoutingStrategy {
config.getGemini31Launched(),
config.getUseCustomToolModel(),
]);
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
const selectedModel = normalizeModelId(
resolveClassifierModel(
normalizeModelId(model),
@@ -194,6 +195,7 @@ export class ClassifierStrategy implements RoutingStrategy {
useCustomToolModel,
config.getHasAccessToPreviewModel?.() ?? true,
config,
useGemini3_5Flash,
),
);
@@ -29,6 +29,7 @@ export class DefaultStrategy implements TerminalStrategy {
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
config.hasGemini35FlashGAAccess?.() ?? false,
);
return {
model: defaultModel,
@@ -31,6 +31,7 @@ export class FallbackStrategy implements RoutingStrategy {
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
config.hasGemini35FlashGAAccess?.() ?? false,
);
const service = config.getModelAvailabilityService();
const snapshot = service.snapshot(resolvedModel);
@@ -12,6 +12,7 @@ import type { BaseLlmClient } from '../../core/baseLlmClient.js';
import {
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_MODEL,
PREVIEW_GEMINI_MODEL_AUTO,
} from '../../config/models.js';
import type { Content } from '@google/genai';
import { debugLogger } from '../../utils/debugLogger.js';
@@ -323,4 +324,24 @@ second message
expect(lastTurn!.parts!.at(0)!.text).toEqual(expectedLastTurn);
});
it('should route to DEFAULT_GEMINI_FLASH_MODEL when hasGemini35FlashGAAccess is true', async () => {
mockConfig.hasGemini35FlashGAAccess = vi.fn().mockReturnValue(true);
mockConfig.getModel = () => PREVIEW_GEMINI_MODEL_AUTO;
const mockApiResponse = {
reasoning: 'Simple task',
model_choice: 'flash',
};
mockGenerateJson.mockResolvedValue(mockApiResponse);
const decision = await strategy.route(
mockContext,
mockConfig,
mockBaseLlmClient,
mockLocalLiteRtLmClient,
);
expect(decision?.model).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
});
@@ -216,6 +216,7 @@ ${formattedHistory}
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
const selectedModel = resolveClassifierModel(
context.requestedModel ?? config.getModel(),
@@ -224,6 +225,7 @@ ${formattedHistory}
useCustomToolModel,
hasAccessToPreview,
config,
useGemini3_5Flash,
);
return {
@@ -20,6 +20,7 @@ import {
PREVIEW_GEMINI_MODEL_AUTO,
DEFAULT_GEMINI_MODEL_AUTO,
DEFAULT_GEMINI_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
} from '../../config/models.js';
import { promptIdContext } from '../../utils/promptIdContext.js';
import type { Content } from '@google/genai';
@@ -894,5 +895,27 @@ describe('NumericalClassifierStrategy', () => {
expect(decision?.model).toBe(PREVIEW_GEMINI_3_1_MODEL);
});
it('should route to DEFAULT_GEMINI_FLASH_MODEL when hasGemini35FlashGAAccess is true', async () => {
mockConfig.hasGemini35FlashGAAccess = vi.fn().mockReturnValue(true);
vi.mocked(mockConfig.getModel).mockReturnValue(PREVIEW_GEMINI_MODEL_AUTO);
const mockApiResponse = {
complexity_reasoning: 'Simple task',
complexity_score: 10,
};
vi.mocked(mockBaseLlmClient.generateJson).mockResolvedValue(
mockApiResponse,
);
const decision = await strategy.route(
mockContext,
mockConfig,
mockBaseLlmClient,
mockLocalLiteRtLmClient,
);
expect(decision?.model).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
});
});
@@ -184,6 +184,7 @@ export class NumericalClassifierStrategy implements RoutingStrategy {
config.getGemini31Launched(),
config.getUseCustomToolModel(),
]);
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
const selectedModel = normalizeModelId(
resolveClassifierModel(
normalizeModelId(model),
@@ -192,6 +193,7 @@ export class NumericalClassifierStrategy implements RoutingStrategy {
useCustomToolModel,
config.getHasAccessToPreviewModel?.() ?? true,
config,
useGemini3_5Flash,
),
);
@@ -41,6 +41,7 @@ export class OverrideStrategy implements RoutingStrategy {
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
config.hasGemini35FlashGAAccess?.() ?? false,
),
metadata: {
source: this.name,
@@ -1044,6 +1044,79 @@ describe('ModelConfigService', () => {
});
});
// Resolves a model ID to a concrete model ID based on the provided context.
describe('resolveModelId', () => {
it('should resolve based on useGemini3_5Flash condition', () => {
const config: ModelConfigServiceConfig = {
modelIdResolutions: {
flash: {
default: 'gemini-2.0-flash',
contexts: [
{
condition: { useGemini3_5Flash: true },
target: 'gemini-3.5-flash',
},
],
},
},
};
const service = new ModelConfigService(config);
expect(service.resolveModelId('flash', { useGemini3_5Flash: true })).toBe(
'gemini-3.5-flash',
);
expect(
service.resolveModelId('flash', { useGemini3_5Flash: false }),
).toBe('gemini-2.0-flash');
expect(service.resolveModelId('flash', {})).toBe('gemini-2.0-flash');
});
it('should resolve based on complex conditions including useGemini3_5Flash', () => {
const config: ModelConfigServiceConfig = {
modelIdResolutions: {
'gemini-flash': {
default: 'gemini-3-flash-preview',
contexts: [
{
condition: {
useGemini3_5Flash: false,
hasAccessToPreview: false,
},
target: 'gemini-2.5-flash',
},
{
condition: { useGemini3_5Flash: true },
target: 'gemini-3.5-flash',
},
],
},
},
};
const service = new ModelConfigService(config);
// Case 1: GA Access granted
expect(
service.resolveModelId('gemini-flash', { useGemini3_5Flash: true }),
).toBe('gemini-3.5-flash');
// Case 2: GA Access denied, but has preview access
expect(
service.resolveModelId('gemini-flash', {
useGemini3_5Flash: false,
hasAccessToPreview: true,
}),
).toBe('gemini-3-flash-preview');
// Case 3: GA Access denied AND no preview access
expect(
service.resolveModelId('gemini-flash', {
useGemini3_5Flash: false,
hasAccessToPreview: false,
}),
).toBe('gemini-2.5-flash');
});
});
describe('getAvailableModelOptions', () => {
it('should filter out Pro models when hasAccessToProModel is false', () => {
const config: ModelConfigServiceConfig = {
@@ -97,6 +97,7 @@ export interface ModelResolution {
export interface ResolutionContext {
useGemini3_1?: boolean;
useGemini3_1FlashLite?: boolean;
useGemini3_5Flash?: boolean;
useCustomTools?: boolean;
hasAccessToPreview?: boolean;
hasAccessToProModel?: boolean;
@@ -107,6 +108,7 @@ export interface ResolutionContext {
export interface ResolutionCondition {
useGemini3_1?: boolean;
useGemini3_1FlashLite?: boolean;
useGemini3_5Flash?: boolean;
useCustomTools?: boolean;
hasAccessToPreview?: boolean;
/** Matches if the current model is in this list. */
@@ -155,6 +157,7 @@ export class ModelConfigService {
const definitions = this.config.modelDefinitions ?? {};
const shouldShowPreviewModels = context.hasAccessToPreview ?? false;
const useGemini31 = context.useGemini3_1 ?? false;
const useGemini3_5Flash = context.useGemini3_5Flash ?? false;
const mainOptions = Object.entries(definitions)
.filter(([_, m]) => {
@@ -169,6 +172,7 @@ export class ModelConfigService {
description = getAutoModelDescription(
shouldShowPreviewModels,
useGemini31,
useGemini3_5Flash,
);
} else if (id === 'auto-gemini-3' && useGemini31) {
description = description.replace('gemini-3-pro', 'gemini-3.1-pro');
@@ -250,6 +254,8 @@ export class ModelConfigService {
return value === context.useGemini3_1;
case 'useGemini3_1FlashLite':
return value === context.useGemini3_1FlashLite;
case 'useGemini3_5Flash':
return value === context.useGemini3_5Flash;
case 'useCustomTools':
return value === context.useCustomTools;
case 'hasAccessToPreview':
@@ -145,6 +145,18 @@
"topK": 64
}
},
"gemini-3.5-flash": {
"model": "gemini-3.5-flash",
"generateContentConfig": {
"temperature": 1,
"topP": 0.95,
"thinkingConfig": {
"includeThoughts": true,
"thinkingLevel": "HIGH"
},
"topK": 64
}
},
"gemma-4-31b-it": {
"model": "gemma-4-31b-it",
"generateContentConfig": {
@@ -183,6 +195,13 @@
"topP": 1
}
},
"gemini-3.5-flash-base": {
"model": "gemini-3.5-flash",
"generateContentConfig": {
"temperature": 0,
"topP": 1
}
},
"classifier": {
"model": "flash-lite",
"generateContentConfig": {
@@ -145,6 +145,18 @@
"topK": 64
}
},
"gemini-3.5-flash": {
"model": "gemini-3.5-flash",
"generateContentConfig": {
"temperature": 1,
"topP": 0.95,
"thinkingConfig": {
"includeThoughts": true,
"thinkingLevel": "HIGH"
},
"topK": 64
}
},
"gemma-4-31b-it": {
"model": "gemma-4-31b-it",
"generateContentConfig": {
@@ -183,6 +195,13 @@
"topP": 1
}
},
"gemini-3.5-flash-base": {
"model": "gemini-3.5-flash",
"generateContentConfig": {
"temperature": 0,
"topP": 1
}
},
"classifier": {
"model": "flash-lite",
"generateContentConfig": {
+17 -11
View File
@@ -1061,18 +1061,24 @@ export class ShellToolInvocation extends BaseToolInvocation<
}
signal.removeEventListener('abort', onAbort);
timeoutController.signal.removeEventListener('abort', onAbort);
if (tempFilePath) {
try {
await fsPromises.unlink(tempFilePath);
} catch {
// Ignore errors during unlink
// Only clean up if NOT running in background.
// Background processes need the temp directory and PID file to remain
// available until they exit.
if (!this.params.is_background) {
if (tempFilePath) {
try {
await fsPromises.unlink(tempFilePath);
} catch {
// Ignore errors during unlink
}
}
}
if (tempDir) {
try {
await fsPromises.rm(tempDir, { recursive: true, force: true });
} catch {
// Ignore errors during rm
if (tempDir) {
try {
await fsPromises.rm(tempDir, { recursive: true, force: true });
} catch {
// Ignore errors during rm
}
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli-devtools",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"license": "Apache-2.0",
"type": "module",
"main": "dist/src/index.js",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli-sdk",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"description": "Gemini CLI SDK",
"license": "Apache-2.0",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@google/gemini-cli-test-utils",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"private": true,
"main": "src/index.ts",
"license": "Apache-2.0",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "gemini-cli-vscode-ide-companion",
"displayName": "Gemini CLI Companion",
"description": "Enable Gemini CLI with direct access to your IDE workspace.",
"version": "0.45.0-nightly.20260521.g854f811be",
"version": "0.46.0-preview.1",
"publisher": "google",
"icon": "assets/icon.png",
"repository": {
File diff suppressed because one or more lines are too long