Skip to content

fix(tui): keep session directory filter toggle usable in the picker - #42056

Open
thepigdestroyer wants to merge 1 commit into
anomalyco:devfrom
thepigdestroyer:fix/session-filter-modal-binding
Open

fix(tui): keep session directory filter toggle usable in the picker#42056
thepigdestroyer wants to merge 1 commit into
anomalyco:devfrom
thepigdestroyer:fix/session-filter-modal-binding

Conversation

@thepigdestroyer

@thepigdestroyer thepigdestroyer commented Aug 12, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #42060

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

A key bound to app.toggle.session_directory_filter does nothing inside the session picker, which is where the toggle matters. It works on the main screen, so it looks intermittent.

Cause: the command sits in appBindingCommands, which is gathered with mode: OPENCODE_BASE_MODE. Opening a dialog pushes "modal" in ui/dialog.tsx, so that layer goes inactive, and the picker is a dialog.

Fix: move the command to appGlobalBindingCommands, which is gathered without a mode. That list already holds session.list and the quick-switch commands for the same reason. Dialog-owned layers still win keys they bind, since dialog bindings are registered by the dialog itself, and this keybind defaults to none so no new conflict is introduced.

Second change in the same command: dialog.clear() ran unconditionally, so toggling from inside the picker closed it and hid the result. The picker's resource queries on sync.session.query(), so leaving it open re-lists in place. Palette invocations still clear as before. Happy to drop this part if you would rather keep the PR to the layer move.

How did you verify your code works?

  • Bound ctrl+a locally. Before: works on main screen, dead in the picker. After: works in both, and the picker stays open and re-lists.
  • Confirmed the mode interaction directly rather than by eye: pushing "modal" via getOpencodeModeStack(keymap).push("modal") and reading getCommandBindings({ visibility: "active" }) gives 0 active bindings before the change and 1 after.
  • bun run typecheck in packages/tui, clean.
  • bun test test/keymap.test.tsx test/component/dialog-session-list.test.ts test/config.test.tsx, 16 pass.

I have a regression test for the modal case but left it out, because asserting it needs appBindingCommands and appGlobalBindingCommands exported from app.tsx and I did not want to widen the module API uninvited. Say the word and I will add it.

Screenshots / recordings

No visual change. The keybind defaults to none, so nothing differs unless a user binds it.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

app.toggle.session_directory_filter was listed in appBindingCommands,
which is gathered under mode OPENCODE_BASE_MODE. Opening a dialog pushes
"modal" (ui/dialog.tsx), so the binding was inactive inside the session
picker, the one place the toggle is worth reaching. Bound to a key it
appeared to work on the main screen and do nothing in the picker.

Move it to appGlobalBindingCommands, which is gathered without a mode and
stays active while a dialog is open.

Also keep the picker open when the toggle runs from inside it. The picker
resource queries on sync.session.query(), so it re-lists in place;
clearing the dialog hid the result of the toggle. Invocations from the
command palette still clear as before.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: session directory filter keybind is inactive inside the session picker

1 participant