feat(cli): Prevent queuing of slash and shell commands (#11094)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Jainam M
2025-10-15 22:32:50 +05:30
committed by GitHub
parent b8df8b2ab8
commit 4f17eae5cc
7 changed files with 215 additions and 2 deletions
+20
View File
@@ -93,6 +93,7 @@ import { useExtensionUpdates } from './hooks/useExtensionUpdates.js';
import { ShellFocusContext } from './contexts/ShellFocusContext.js';
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
const QUEUE_ERROR_DISPLAY_DURATION_MS = 3000;
function isToolExecuting(pendingHistoryItems: HistoryItemWithoutId[]) {
return pendingHistoryItems.some((item) => {
@@ -154,6 +155,10 @@ export const AppContainer = (props: AppContainerProps) => {
config.isTrustedFolder(),
);
const [queueErrorMessage, setQueueErrorMessage] = useState<string | null>(
null,
);
const extensions = config.getExtensions();
const {
extensionsUpdateState,
@@ -815,6 +820,17 @@ Logging in with Google... Please restart Gemini CLI to continue.
}
}, [ideNeedsRestart]);
useEffect(() => {
if (queueErrorMessage) {
const timer = setTimeout(() => {
setQueueErrorMessage(null);
}, QUEUE_ERROR_DISPLAY_DURATION_MS);
return () => clearTimeout(timer);
}
return undefined;
}, [queueErrorMessage, setQueueErrorMessage]);
useEffect(() => {
if (isInitialMount.current) {
isInitialMount.current = false;
@@ -1131,6 +1147,7 @@ Logging in with Google... Please restart Gemini CLI to continue.
currentLoadingPhrase,
historyRemountKey,
messageQueue,
queueErrorMessage,
showAutoAcceptIndicator,
showWorkspaceMigrationDialog,
workspaceExtensions,
@@ -1212,6 +1229,7 @@ Logging in with Google... Please restart Gemini CLI to continue.
currentLoadingPhrase,
historyRemountKey,
messageQueue,
queueErrorMessage,
showAutoAcceptIndicator,
showWorkspaceMigrationDialog,
workspaceExtensions,
@@ -1276,6 +1294,7 @@ Logging in with Google... Please restart Gemini CLI to continue.
onWorkspaceMigrationDialogOpen,
onWorkspaceMigrationDialogClose,
handleProQuotaChoice,
setQueueErrorMessage,
}),
[
handleThemeSelect,
@@ -1301,6 +1320,7 @@ Logging in with Google... Please restart Gemini CLI to continue.
onWorkspaceMigrationDialogOpen,
onWorkspaceMigrationDialogClose,
handleProQuotaChoice,
setQueueErrorMessage,
],
);