Skip to content

session_child_cycle + session_child_cycle_reverse stopped working #10444

Closed as not planned

Description

@jdanbrown

Description

The session_child_cycle + session_child_cycle_reverse keybinds used to work to scroll up/down through user messages, but they don't work now.

Repro:

  • Run opencode -s on a session with a lot of user messages, enough to overflow the terminal height
  • Press ctrl+x, right / ctrl+x left to trigger session_child_cycle / `session_child_cycle_reverse
  • Observe that ctrl+x (leader) is recognized (the prompt box unfocuses), but nothing happens when you then press left/right

Tested with an empty config:

$ opencode debug config
{
  "$schema": "https://opencode.ai/config.json",
  "agent": {},
  "mode": {},
  "plugin": [],
  "command": {},
  "username": "danb",
  "keybinds": {
    "leader": "ctrl+x",
    "app_exit": "ctrl+c,ctrl+d,<leader>q",
    "editor_open": "<leader>e",
    "theme_list": "<leader>t",
    "sidebar_toggle": "<leader>b",
    "scrollbar_toggle": "none",
    "username_toggle": "none",
    "status_view": "<leader>s",
    "session_export": "<leader>x",
    "session_new": "<leader>n",
    "session_list": "<leader>l",
    "session_timeline": "<leader>g",
    "session_fork": "none",
    "session_rename": "ctrl+r",
    "session_delete": "ctrl+d",
    "stash_delete": "ctrl+d",
    "model_provider_list": "ctrl+a",
    "model_favorite_toggle": "ctrl+f",
    "session_share": "none",
    "session_unshare": "none",
    "session_interrupt": "escape",
    "session_compact": "<leader>c",
    "messages_page_up": "pageup,ctrl+alt+b",
    "messages_page_down": "pagedown,ctrl+alt+f",
    "messages_line_up": "ctrl+alt+y",
    "messages_line_down": "ctrl+alt+e",
    "messages_half_page_up": "ctrl+alt+u",
    "messages_half_page_down": "ctrl+alt+d",
    "messages_first": "ctrl+g,home",
    "messages_last": "ctrl+alt+g,end",
    "messages_next": "none",
    "messages_previous": "none",
    "messages_last_user": "none",
    "messages_copy": "<leader>y",
    "messages_undo": "<leader>u",
    "messages_redo": "<leader>r",
    "messages_toggle_conceal": "<leader>h",
    "tool_details": "none",
    "model_list": "<leader>m",
    "model_cycle_recent": "f2",
    "model_cycle_recent_reverse": "shift+f2",
    "model_cycle_favorite": "none",
    "model_cycle_favorite_reverse": "none",
    "command_list": "ctrl+p",
    "agent_list": "<leader>a",
    "agent_cycle": "tab",
    "agent_cycle_reverse": "shift+tab",
    "variant_cycle": "ctrl+t",
    "input_clear": "ctrl+c",
    "input_paste": "ctrl+v",
    "input_submit": "return",
    "input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
    "input_move_left": "left,ctrl+b",
    "input_move_right": "right,ctrl+f",
    "input_move_up": "up",
    "input_move_down": "down",
    "input_select_left": "shift+left",
    "input_select_right": "shift+right",
    "input_select_up": "shift+up",
    "input_select_down": "shift+down",
    "input_line_home": "ctrl+a",
    "input_line_end": "ctrl+e",
    "input_select_line_home": "ctrl+shift+a",
    "input_select_line_end": "ctrl+shift+e",
    "input_visual_line_home": "alt+a",
    "input_visual_line_end": "alt+e",
    "input_select_visual_line_home": "alt+shift+a",
    "input_select_visual_line_end": "alt+shift+e",
    "input_buffer_home": "home",
    "input_buffer_end": "end",
    "input_select_buffer_home": "shift+home",
    "input_select_buffer_end": "shift+end",
    "input_delete_line": "ctrl+shift+d",
    "input_delete_to_line_end": "ctrl+k",
    "input_delete_to_line_start": "ctrl+u",
    "input_backspace": "backspace,shift+backspace",
    "input_delete": "ctrl+d,delete,shift+delete",
    "input_undo": "ctrl+-,super+z",
    "input_redo": "ctrl+.,super+shift+z",
    "input_word_forward": "alt+f,alt+right,ctrl+right",
    "input_word_backward": "alt+b,alt+left,ctrl+left",
    "input_select_word_forward": "alt+shift+f,alt+shift+right",
    "input_select_word_backward": "alt+shift+b,alt+shift+left",
    "input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
    "input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
    "history_previous": "up",
    "history_next": "down",
    "session_child_cycle": "<leader>right",
    "session_child_cycle_reverse": "<leader>left",
    "session_parent": "<leader>up",
    "terminal_suspend": "ctrl+z",
    "terminal_title_toggle": "none",
    "tips_toggle": "<leader>h"
  }
}

Plugins

none

OpenCode version

1.1.34

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

vscode terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 24, 2026
  2. github-actions commented on Jan 24, 2026

    @github-actions
    Contributor

    This issue might be related to existing issues with leader keybind handling. Please check:

    These issues suggest a broader problem with how leader keybinds and multi-key sequences are being processed after recent changes.

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

  3. jdanbrown commented on Jan 24, 2026

    @jdanbrown
    ContributorAuthor

    These issues suggest a broader problem with how leader keybinds and multi-key sequences are being processed after recent changes.

    Nope, the same nothing happens even if I rebind them to keys that don't use leader, e.g.

        "session_child_cycle": "ctrl+alt+j",
        "session_child_cycle_reverse": "ctrl+alt+k",
  4. EdgarSedov commented on Feb 24, 2026

    @EdgarSedov

    Additional datapoint from Linux Mint (likely same root issue):

    • Symptom: subagent session navigation controls do not work (right, left, up), while leader itself is recognized (ctrl+x works).
    • In the same shell, arrow keys are emitted correctly:
      • cat -v then arrows => ^[[D^[[C^[[A
      • echo $TERM => xterm-256color
      • echo $TMUX => empty
    • This points to a TUI key handling mismatch rather than terminal not sending arrows.

    Workaround that consistently fixes it for this environment:

    env -u TMUX TERM=xterm-256color opencode

    After launching this way, subagent controls worked reliably (tested by running 3 concurrent ~60s subagent tasks and navigating between child sessions).

    Could be useful to log/inspect effective TERM and parsed key sequences in the subagent/session-child navigation path specifically (session_child_cycle, session_child_cycle_reverse, session_parent).

  5. jerome-benoit commented on Mar 3, 2026

    @jerome-benoit
    Contributor

    Looked into this while working on #15761 / #15762. Two separate issues seem to be at play:

    1. Guard logic blocks cycling even when it should work

    session_child_cycle / session_child_cycle_reverse are gated by childSessionHandler, which early-returns when !session()?.parentID. This means the commands are no-ops in a root session. Additionally, enabled: !!session()?.parentID (added in #15762 to fix arrow key interception) disables the commands entirely at root level.

    For session_parent this is correct — no parent means nothing to navigate to. But for child cycling, the guard should arguably be children().length > 1 instead, since children() already includes siblings from the root perspective and moveChild() does its own bounds checking.

    2. Terminal key sequence parsing (likely the original reporter's issue)

    @jdanbrown noted that rebinding to ctrl+alt+j still doesn't work, and @EdgarSedov found that env -u TMUX TERM=xterm-256color opencode fixes it. This points to a key sequence parsing issue in certain terminal/TERM combinations rather than a logic bug — the keybind events may never reach the command handler at all.

    These are independent problems. The guard logic could be improved (replace parentID check with children().length > 1 for the cycle commands, adjust childSessionHandler accordingly), but that won't help users hitting the terminal key parsing issue.

  6. Wangmerlyn commented on Mar 7, 2026

    @Wangmerlyn
    Contributor

    Hi @jdanbrown and @jerome-benoit,
    I'm new to OpenCode and was looking into this issue. I think this might be related to a documentation mismatch I'm trying to address in #16462 and PR #16455, but I could be wrong since I'm still learning the codebase.
    From what I can tell, the navigation behavior seems to have changed after PR #14814 (Feb 2026). The current docs suggest using <leader>+right/left to cycle, but the actual implementation appears to work differently now:

    • First enter a child session with <leader> +down
    • Then use bare right/left arrows (without leader) to cycle between children
    • Press up to go back to parent
      I'm also seeing that PR fix(opencode): disable session navigation commands when no parent session #15762 added some guards that might disable these navigation commands when not in a child session, which could explain why nothing happens.
      Would you mind checking if the hierarchical navigation flow (enter with <leader>+down, then bare arrows) works for you? If not, there might be a different issue here.
      I'm updating the docs to clarify this in docs: clarify subagent session navigation keybinds #16455 - feedback welcome since I'm still figuring things out!
  7. removed
    bugSomething isn't working
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  8. github-actions commented on Jul 6, 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions