Skip to content

Conversation

@madebyaris
Copy link
Contributor

Remove the model by using /model-delete from custom, and also we add delete preventation if it's active

image

@rifkybujana rifkybujana requested a review from Copilot December 9, 2025 10:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new /model-delete CLI command that allows users to remove custom saved models, with built-in safeguards to prevent deletion of active models and Kolosal Cloud models.

  • Implements /model-delete command with validation to prevent deletion of active or Kolosal-managed models
  • Adds interactive confirmation dialog for model deletion
  • Integrates delete functionality into the existing model selection dialog via 'd' key

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/cli/src/ui/hooks/slashCommandProcessor.ts Adds handler for new model_delete dialog action
packages/cli/src/ui/components/ModelSelectionDialog.tsx Adds delete functionality via 'd' key and tracks selected model index
packages/cli/src/ui/components/ModelDeleteConfirmationDialog.tsx New confirmation dialog component for model deletion
packages/cli/src/ui/commands/types.ts Adds model_delete dialog type
packages/cli/src/ui/commands/modelDeleteCommand.ts Implements the core /model-delete command logic with validation
packages/cli/src/ui/commands/modelDeleteCommand.test.ts Test coverage for the model delete command
packages/cli/src/ui/App.tsx Integrates delete dialog and handlers into main app
packages/cli/src/test-utils/mockCommandContext.ts Adds missing sessionId field to mock context
packages/cli/src/services/BuiltinCommandLoader.ts Registers the new model delete command
packages/cli/src/config/savedModels.ts Adds removeSavedModelEntry utility function
packages/cli/src/config/savedModels.test.ts Test coverage for removeSavedModelEntry function
kolosal-server Subproject commit update

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2150 to +2151
// Open model selection dialog filtered to deletable models
setIsModelSelectionDialogOpen(true);
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handleModelDeleteOpen function opens the model selection dialog, but this conflicts with the normal model selection flow. When a user invokes /model-delete, they should see only deletable models, but this opens the same dialog used for model switching. This will confuse users as the dialog doesn't filter to show only deletable models in the delete context.

Suggested change
// Open model selection dialog filtered to deletable models
setIsModelSelectionDialogOpen(true);
// Open model delete dialog, which will show only deletable models
setIsModelDeleteDialogOpen(true);

Copilot uses AI. Check for mistakes.

const handleModelDeleteOpen = useCallback(() => {
// Open model selection dialog filtered to deletable models
setIsModelSelectionDialogOpen(true);
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model selection dialog is being reused for two different purposes (selection and deletion) without a clear way to distinguish the context. Consider passing a mode parameter or using a separate state variable to indicate whether the dialog is in 'select' or 'delete' mode, which would allow for different filtering and UI behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +80
export function removeSavedModelEntry(
existing: SavedModelEntry[] | undefined,
entry: SavedModelEntry,
): SavedModelEntry[] {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removeSavedModelEntry function is defined but never used in the codebase. The deletion logic in App.tsx (lines 2241-2253) manually filters the array instead of calling this utility function, resulting in code duplication and inconsistency.

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +94
} else if (key.name === 'd' && onDelete) {
const selectedModel = availableModels[selectedIndex];
if (selectedModel && selectedModel.savedModel) {
// Let handleModelDeleteRequest handle the current model check and show error
onDelete(selectedModel);
}
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The delete key handler silently does nothing when a model is not a saved custom model. Consider providing user feedback (e.g., a brief error message) when 'd' is pressed on a non-deletable model to avoid confusion about why the action didn't trigger.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant