You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI: session.child.first/parent arrow keys have surprising behavior #56154
Pressing Down toggles the composer (or closes it if open); pressing Up navigates to the parent session instantly. Both are surprising for plain arrow keys and unguarded by focus.
Thanks for the report! I looked at the current v2 code, and the Up/Down defaults may not be as unguarded as they look. When the prompt has focus, its own higher-priority keybind layers handle Up/Down first: they move the cursor and step through prompt history. The key only reaches session.child.first (Down) or session.parent (Up) once there's no further history entry in that direction. That fallthrough appears to be intentional (the prompt footer shows the Down shortcut for subagents).
To see whether something is actually misbehaving, could you add:
Your OpenCode version (opencode --version), OS and terminal
The exact steps: what had focus when you pressed the arrow key (the prompt, empty or with text, with or without history; a dialog; a permission prompt; the transcript, etc.)
What you expected to happen and what happened instead
You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.
I didn't find an exact duplicate. These related issues are ordered by how closely they match:
Thank you for the detailed investigation. You're right that my finding was overstated.
Looking more carefully at the keymap layers:
The prompt's history navigation layer (component/prompt/index.tsx) has priority: 1 with target: inputTarget, so when the prompt has focus, up/down are handled by the prompt first (cursor movement, then history navigation).
The session.child.first (down) and session.child.previous (right) keybinds from config/keybind.ts:138-139 only fire when the prompt doesn't consume the key.
The composer layer (routes/session/composer/index.tsx:72-82) uses left/right for tab switching, not up/down.
So when the prompt has focus:
down at cursor position > 0: moves cursor down in prompt
down at bottom of prompt: navigates prompt history
down when composer is open: handled by composer's own logic or falls through
The behavior is more nuanced than I described. While there may still be edge cases (e.g., when the composer is open with subagent tabs), the basic case works as expected.
I'll keep this issue open as a minor UX clarification request, but I acknowledge it's not as broken as I initially described. The main concern would be if down in the composer's subagent tab behaves unexpectedly, but that would need separate investigation.
Thanks for taking another look and for writing up the layer order. That matches what I see in the code.
About the remaining case: while the composer is open, it switches the keymap into its own composer mode. Its own layer binds Left/Right to switch tabs and Esc / Ctrl+C to close. Up/Down in the subagent tab should therefore move through that tab's list rather than reach session.child.first / session.parent.
Without a concrete case where a key does something unexpected, there isn't anything specific for maintainers to act on here. If you do hit unexpected arrow-key behaviour (in the subagent tab or anywhere else), please reply with:
your OpenCode version (opencode --version), OS and terminal
the exact steps, including what had focus
what you expected and what happened instead
If nothing comes up, this issue will be closed automatically on 2026-10-19 16:12 UTC. You're welcome to open a new issue with those details later.
Closing this as not planned. As we worked out above, the prompt handles Up/Down first. The session bindings only take over at the edge of the prompt history, and the composer handles its own keys while it's open. We were waiting for a concrete case where an arrow key does something unexpected (for example in the subagent tab), and none has come in.
If you run into one, please open a new issue with your opencode --version, OS and terminal, what had focus, and what you expected compared with what happened. Thanks again for looking into the keymap layers so carefully.
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the report! I looked at the current v2 code, and the Up/Down defaults may not be as unguarded as they look. When the prompt has focus, its own higher-priority keybind layers handle Up/Down first: they move the cursor and step through prompt history. The key only reaches
session.child.first(Down) orsession.parent(Up) once there's no further history entry in that direction. That fallthrough appears to be intentional (the prompt footer shows the Down shortcut for subagents).To see whether something is actually misbehaving, could you add:
opencode --version), OS and terminalYou can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.
I didn't find an exact duplicate. These related issues are ordered by how closely they match:
session.child.next/previousdefaults have no registered commandsAddin commentedon Oct 16, 2026
Thank you for the detailed investigation. You're right that my finding was overstated.
Looking more carefully at the keymap layers:
component/prompt/index.tsx) haspriority: 1withtarget: inputTarget, so when the prompt has focus,up/downare handled by the prompt first (cursor movement, then history navigation).session.child.first(down) andsession.child.previous(right) keybinds fromconfig/keybind.ts:138-139only fire when the prompt doesn't consume the key.routes/session/composer/index.tsx:72-82) usesleft/rightfor tab switching, notup/down.So when the prompt has focus:
downat cursor position > 0: moves cursor down in promptdownat bottom of prompt: navigates prompt historydownwhen composer is open: handled by composer's own logic or falls throughThe behavior is more nuanced than I described. While there may still be edge cases (e.g., when the composer is open with subagent tabs), the basic case works as expected.
I'll keep this issue open as a minor UX clarification request, but I acknowledge it's not as broken as I initially described. The main concern would be if
downin the composer's subagent tab behaves unexpectedly, but that would need separate investigation.opencode-agent commentedon Oct 16, 2026
Thanks for taking another look and for writing up the layer order. That matches what I see in the code.
About the remaining case: while the composer is open, it switches the keymap into its own
composermode. Its own layer binds Left/Right to switch tabs and Esc / Ctrl+C to close. Up/Down in the subagent tab should therefore move through that tab's list rather than reachsession.child.first/session.parent.Without a concrete case where a key does something unexpected, there isn't anything specific for maintainers to act on here. If you do hit unexpected arrow-key behaviour (in the subagent tab or anywhere else), please reply with:
opencode --version), OS and terminalIf nothing comes up, this issue will be closed automatically on 2026-10-19 16:12 UTC. You're welcome to open a new issue with those details later.
opencode-agent commentedon Oct 19, 2026
Closing this as not planned. As we worked out above, the prompt handles Up/Down first. The session bindings only take over at the edge of the prompt history, and the composer handles its own keys while it's open. We were waiting for a concrete case where an arrow key does something unexpected (for example in the subagent tab), and none has come in.
If you run into one, please open a new issue with your
opencode --version, OS and terminal, what had focus, and what you expected compared with what happened. Thanks again for looking into the keymap layers so carefully.