Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 20, 2025

This PR attempts to address Issue #9446. Feedback and guidance are welcome.

Summary

This implementation adds support for hidden submodes that are not shown in the mode selector dropdown but can be accessed programmatically by their parent mode. This allows complex Roo modes to delegate to focused submodes without cluttering the mode dropdown list.

Changes

  • Type definitions: Added hidden and parent optional fields to ModeConfig type
  • Mode filtering: Updated getAllModes() function to support filtering hidden modes with an includeHidden parameter
  • UI updates: Modified mode selector components to exclude hidden modes from dropdowns
  • Parent validation: Added validation in switch_mode tool to ensure hidden modes can only be accessed by their parent mode
  • Settings view: Hidden modes are still visible in the settings view for management purposes
  • Tests: Added comprehensive test suite for hidden mode functionality
  • Example: Created example .roomodes file demonstrating the feature

How it works

  1. Define a hidden submode in .roomodes with hidden: true and parent: <parent-slug>
  2. The submode will not appear in mode selector dropdowns
  3. Parent mode can switch to the submode using the switch_mode tool
  4. Other modes cannot access the hidden submode directly

Example Usage

customModes:
  - slug: complex-handler
    name: Complex Handler
    # ... other config
    
  - slug: data-analyzer
    name: Data Analyzer
    hidden: true
    parent: complex-handler
    # ... other config

Testing

  • All new tests pass ✅
  • Existing mode tests pass without regression ✅
  • Type checking passes ✅
  • Linting passes ✅

Closes #9446


Important

Adds hidden submodes for complex Roo modes, allowing programmatic access by parent modes while excluding them from UI dropdowns, with updates to mode configuration, UI components, and validation logic.

  • Behavior:
    • Adds hidden and parent fields to ModeConfig in mode.ts.
    • Updates getAllModes() in modes.ts to filter hidden modes unless includeHidden is true.
    • Modifies SwitchModeTool in SwitchModeTool.ts to validate parent access for hidden modes.
  • UI:
    • Excludes hidden modes from dropdowns in ChatTextArea.tsx, ChatView.tsx, ModeSelector.tsx.
    • Includes hidden modes in settings view in ModesView.tsx.
  • Testing:
    • Adds tests for hidden mode functionality in modes.hidden.spec.ts.

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

- Add hidden and parent fields to ModeConfig type
- Update getAllModes to support filtering hidden modes
- Hide submodes from mode selector dropdowns
- Add parent mode validation in switch_mode tool
- Include hidden modes in settings view for management
- Add comprehensive tests for hidden mode functionality
- Create example .roomodes file demonstrating usage

Closes #9446
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 20, 2025 21:29
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Nov 20, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 20, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. Found 2 issues that should be addressed:

  • Schema validation: The ModeConfig schema allows hidden: true without requiring parent, which would create inaccessible modes
  • Parent mode validation: The switch_mode tool doesn't verify that the parent mode exists before allowing access to hidden modes

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 20, 2025
Comment on lines +73 to +74
hidden: z.boolean().optional(),
parent: z.string().optional(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The schema allows hidden: true without requiring parent, which would create modes that are completely inaccessible. If a mode is hidden but has no parent, there's no way to switch to it. The schema should enforce that if hidden is true, then parent must be provided.

Consider adding a .refine() validation like:

.refine(
  (data) => !data.hidden || data.parent,
  { message: "Hidden modes must specify a parent mode" }
)

Fix it with Roo Code or mention @roomote and request a fix.

Comment on lines +54 to +66
// Check if the target mode is hidden
if (targetMode.hidden) {
// Hidden modes can only be accessed by their parent mode
if (!targetMode.parent || targetMode.parent !== currentMode) {
task.recordToolError("switch_mode")
pushToolResult(
formatResponse.toolError(
`Mode '${mode_slug}' is not accessible from the current mode '${currentMode}'.`,
),
)
return
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code checks if targetMode.parent equals currentMode, but it doesn't verify that the parent mode actually exists in the available modes. If someone defines a hidden mode with a non-existent parent slug, this validation would pass (assuming you're in that non-existent mode somehow), but the parent-child relationship would be invalid.

Consider adding validation to ensure the parent mode exists:

if (targetMode.hidden) {
    if (!targetMode.parent) {
        // error: hidden mode must have parent
    }
    const parentMode = getModeBySlug(targetMode.parent, customModes)
    if (!parentMode) {
        // error: parent mode does not exist
    }
    if (targetMode.parent !== currentMode) {
        // error: can only be accessed by parent
    }
}

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Ability to define hidden modes and submodes of a mode

3 participants