Skip to content

Add interactive session switcher for navigating between subagent sessions #6183

Closed as not planned

Description

@rmk40

Problem

When working with subagent sessions (e.g., tasks spawned by the task tool), navigation currently requires cycling through sessions one-by-one using <leader>right / <leader>left. This becomes inefficient when:

  • Multiple subagents are spawned from a single parent session
  • Subagents spawn their own subagents (nested hierarchy)
  • You need to jump directly to a specific session (e.g., one awaiting permission input)

There's no way to see all related sessions at once or jump directly to a specific one.

Proposed Solution

Add an interactive session switcher dialog that:

  1. Shows hierarchical view of parent and all descendant sessions (up to 3 levels deep)
  2. Displays session status - busy spinner for active sessions, permission indicator for sessions awaiting user input
  3. Allows direct navigation - select any session from the list instead of cycling through sequentially
  4. Integrates with command palette - appears in suggested commands when subagents exist

Keybind

<leader>s (configurable via session_child_list)

UI Example

Switch Session
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Parent
  ● Main session title                              2m ago

Subagents
    explore task                                    1m ago
    code-review task                               45s ago

Subagents › explore
  ◉ nested-search task                             30s ago
  • ● indicates current session
  • ◉ (warning color) indicates session awaiting permission
  • Spinner shown for busy/active sessions

Why This Is Useful

Direct selection is significantly more efficient than sequential cycling when you have 5+ subagent sessions and need to:

  • Check on a specific task's progress
  • Respond to a permission prompt in a nested subagent
  • Return to the parent session after reviewing children

Implementation Approach

The implementation reuses existing patterns from the codebase:

  • DialogSelect component for the selection UI (same as DialogSessionList, DialogTimeline)
  • sync.data.permission[sessionID] for pending permission detection
  • sync.data.session_status[sessionID] for busy state detection
  • Category grouping for hierarchical display (same pattern as date grouping in DialogSessionList)

Style note

The implementation uses a let statement when walking up the session tree to find the root parent:

let current = currentSession()
while (current?.parentID) {
  const parent = sync.session.get(current.parentID)
  if (!parent) break
  current = parent
}

This is a legitimate use case where let is appropriate - the variable must be reassigned during iterative traversal. Per the style guide, let should be avoided where possible, but not prohibited when it's the natural solution.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 26, 2025
  2. github-actions commented on Dec 26, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. rmk40 commented on Dec 26, 2025

    @rmk40
    ContributorAuthor

    After reviewing the related issues:

    This PR (#6184) addresses the core problem shared across these issues:

    The implementation is intentionally minimal - it reuses existing DialogSelect patterns and doesn't introduce new UI paradigms. It's designed to coexist with future enhancements like a persistent tab bar (#5826) or tree sidebar (#6032).

  4. Eric-GoodBoy-Tech commented on Feb 27, 2026

    @Eric-GoodBoy-Tech

    Great work on this! 🎉

    This would significantly improve the subagent navigation experience. A few suggestions that could complement this feature:

    1. Status bar integration - Show subagent count/status in the bottom bar (e.g., 3 subagents [1⏳ 2✓]) for quick visibility without opening the dialog

    2. Auto-switch options - Optional config to auto-switch when:

      • A subagent requests permission (auto-focus to pending)
      • A subagent completes (auto-return to parent)
    3. Plugin hooks - Expose subagent events (created, permission_pending, completed) for plugins to monitor/manage sessions

    These would make the subagent workflow even more seamless. Thanks for driving this forward! 👍

  5. github-actions commented on Apr 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions