Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jul 16, 2025

Fixes #5766

Problem

If the user cleared the custom mode name field, the change was saved immediately. This made the custom modes YAML file invalid, and all custom modes disappeared.

Solution

Keep a local state while the field is being edited. Only save the change on blur, and only if the name is not empty.


Important

Fixes issue with empty mode names by adding local state management and backend validation in ModesView.tsx and CustomModesManager.ts.

  • Behavior:
    • Allows users to visually empty mode name field in ModesView.tsx.
    • Saves only non-empty mode names on blur in ModesView.tsx.
    • Backend validation in CustomModesManager.ts to reject empty mode names.
  • State Management:
    • Adds localModeName and currentEditingModeSlug state in ModesView.tsx to manage input field state.
    • Resets local state when mode changes in ModesView.tsx.
  • Validation:
    • Validates mode configuration using modeConfigSchema in CustomModesManager.ts.

This description was created by Ellipsis for fc2c886. You can customize this summary. It will automatically update as commits are pushed.

- Add local state management for mode name input field to allow visual emptying
- Implement onBlur validation to only save non-empty names
- Add backend validation using modeConfigSchema.safeParse()
- Ensure empty names are never written to YAML files

This allows users to clear the name field visually while preventing
invalid empty names from being persisted to configuration files.
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners July 16, 2025 21:08
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 16, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jul 16, 2025

No security or compliance issues detected. Reviewed everything up to fc2c886.

Security Overview
  • 🔎 Scanned files: 2 changed file(s)
Detected Code Changes
Change Type Relevant files
Bug Fix ► CustomModesManager.ts
    Add validation for mode configuration using modeConfigSchema
► ModesView.tsx
    Implement local state management for mode names
    Add onBlur validation for non-empty names
Refactor ► getEnvironmentDetails.ts
    Improve time formatting and display
► scanner.ts
    Refactor code block processing and batch handling
► constants/index.ts
    Update MAX_LIST_FILES_LIMIT constant
► file-processor.ts
    Add codeBlocks to return interface

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jul 16, 2025
@mrubens mrubens merged commit 2458751 into main Jul 16, 2025
23 checks passed
@mrubens mrubens deleted the fix/issue-5766-empty-mode-name branch July 16, 2025 21:50
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 16, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 16, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 16, 2025
fxcl added a commit to tameslabs/Roo-Cline that referenced this pull request Jul 16, 2025
* main:
  fix: Resolve confusing auto-approve checkbox states (RooCodeInc#5602)
  fix: prevent empty mode names from being saved (RooCodeInc#5766) (RooCodeInc#5794)
  Format time in ISO 8601 (RooCodeInc#5793)
  fix: resolve DirectoryScanner memory leak and improve file limit handling (RooCodeInc#5785)
  Fix settings dirty check (RooCodeInc#5779)
  feat: increase Ollama API timeout values and extract as constants (RooCodeInc#5778)
  fix: Exclude Terraform and Terragrunt cache directories from checkpoints (RooCodeInc#4601) (RooCodeInc#5750)
  Move less commonly used provider settings into an advanced dropdown (RooCodeInc#5762)
  feat: Add configurable error & repetition limit with unified control (RooCodeInc#5654) (RooCodeInc#5752)
  list-files must include at least the first-level directory contents (RooCodeInc#5303)
  Update evals repo link (RooCodeInc#5758)
  Feature/vertex ai model name conversion (RooCodeInc#5728)
  fix(litellm): handle baseurl with paths correctly (RooCodeInc#5697)
  Add telemetry for todos (RooCodeInc#5746)
  feat: add undo functionality for enhance prompt feature (fixes RooCodeInc#5741) (RooCodeInc#5742)
  Fix max_tokens limit for moonshotai/kimi-k2-instruct on Groq (RooCodeInc#5740)
  Changeset version bump (RooCodeInc#5735)
  Add changeset for v3.23.12 patch release (RooCodeInc#5734)
  Update the max-token calculation in model-params to use the shared logic (RooCodeInc#5720)
  Changeset version bump (RooCodeInc#5719)
  chore: add changeset for v3.23.11 patch release (RooCodeInc#5718)
  Add Kimi K2 model and better support (RooCodeInc#5717)
  Fix: Remove invalid skip-checkout parameter from GitHub Actions workflows (RooCodeInc#5676)
  feat: add Cmd+Shift+. keyboard shortcut for previous mode switching (RooCodeInc#5695)
  Changeset version bump (RooCodeInc#5708)
  chore: add changeset for v3.23.10 patch release (RooCodeInc#5707)
  Add padding to the index model options (RooCodeInc#5706)
  fix: prioritize built-in model dimensions over custom dimensions (RooCodeInc#5705)
  Update CHANGELOG.md
  Changeset version bump (RooCodeInc#5702)
  chore: add changeset for v3.23.9 patch release (RooCodeInc#5701)
  Tweaks to command timeout error (RooCodeInc#5700)
  Update contributors list (RooCodeInc#5639)
  feat: enable Claude Code provider to run natively on Windows (RooCodeInc#5615)
  feat: Add configurable timeout for command execution (RooCodeInc#5668)
  feat: add gemini-embedding-001 model to code-index service (RooCodeInc#5698)
  fix: resolve vector dimension mismatch error when switching embedding models (RooCodeInc#5616) (RooCodeInc#5617)
  fix: [5424] return the cwd in the exec tool's response so that the model is not lost after subsequent calls (RooCodeInc#5667)
  Changeset version bump (RooCodeInc#5670)
  chore: add changeset for v3.23.8 patch release (RooCodeInc#5669)
roomote bot pushed a commit that referenced this pull request Jul 18, 2025
- Enhanced CustomModesManager.ts with comprehensive validation for all fields
- Added validation for required fields (name, roleDefinition, slug) and optional fields (description, whenToUse, customInstructions)
- Implemented checks to prevent empty strings from being saved (should be undefined instead)
- Extended local state management pattern from PR #5794 to ALL editable fields in ModesView.tsx
- Added local state variables for all fields: localModeName, localModeDescription, localModeRoleDefinition, localModeWhenToUse, localModeCustomInstructions
- Implemented onFocus/onChange/onBlur pattern for all editable fields to prevent empty field saves
- Users can now visually clear fields during editing but empty values are prevented from being saved
- This prevents custom modes from disappearing due to empty field validation issues

Fixes custom modes disappearing and creation issues by extending validation pattern from PR #5794
roomote bot pushed a commit that referenced this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Bug: Empty name field in mode YAML file after deleting all characters in Roo Code plugin

4 participants