mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 00:14:28 -07:00
fix(cli): prevent automatic updates from switching to less stable channels (#26132)
This commit is contained in:
@@ -11,7 +11,11 @@ import { updateEventEmitter } from './updateEventEmitter.js';
|
||||
import { MessageType, type HistoryItem } from '../ui/types.js';
|
||||
import { spawnWrapper } from './spawnWrapper.js';
|
||||
import type { spawn } from 'node:child_process';
|
||||
import { debugLogger } from '@google/gemini-cli-core';
|
||||
import {
|
||||
debugLogger,
|
||||
getChannelFromVersion,
|
||||
RELEASE_CHANNEL_STABILITY,
|
||||
} from '@google/gemini-cli-core';
|
||||
|
||||
let _updateInProgress = false;
|
||||
|
||||
@@ -122,6 +126,25 @@ export function handleAutoUpdate(
|
||||
return;
|
||||
}
|
||||
|
||||
const currentVersion = info.update.current;
|
||||
if (!currentVersion) {
|
||||
debugLogger.warn(
|
||||
'Update check: current version is missing. Skipping automatic update for safety.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const currentChannel = getChannelFromVersion(currentVersion);
|
||||
const targetChannel = getChannelFromVersion(info.update.latest);
|
||||
|
||||
// Defense-in-depth: prevent updates to a less stable channel
|
||||
if (
|
||||
RELEASE_CHANNEL_STABILITY[targetChannel] <
|
||||
RELEASE_CHANNEL_STABILITY[currentChannel]
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isNightly = info.update.latest.includes('nightly');
|
||||
|
||||
const updateCommand = installationInfo.updateCommand.replace(
|
||||
|
||||
Reference in New Issue
Block a user