TUI command dialog should ignore undefined options #6831

Closed
opened 2026-02-16 18:05:24 -05:00 by yindo · 1 comment
Owner

Originally created by @adolago on GitHub (Jan 19, 2026).

Originally assigned to: @rekram1-node on GitHub.

Problem

dialog-command assumes each registration returns an array of options. Undefined values can crash the command palette and prevent keybind handling.

Proposed fix

  • In packages/agent-core/src/cli/cmd/tui/component/dialog-command.tsx, flatten registrations with x() ?? [].
  • Filter falsy entries before mapping to dialog options.
  • Compute options via a function (not a static memo) so test contexts see new registrations.
  • Export a createCommandDialog factory so tests can instantiate without JSX.

Acceptance criteria

  • No crash when any command.register returns undefined or contains undefined entries.
  • Keybind footer strings render correctly for options with a keybind.

Test plan

  • cd packages/agent-core
  • bun test test/cli/tui/dialog-command.test.ts
Originally created by @adolago on GitHub (Jan 19, 2026). Originally assigned to: @rekram1-node on GitHub. ## Problem `dialog-command` assumes each registration returns an array of options. Undefined values can crash the command palette and prevent keybind handling. ## Proposed fix - In `packages/agent-core/src/cli/cmd/tui/component/dialog-command.tsx`, flatten registrations with `x() ?? []`. - Filter falsy entries before mapping to dialog options. - Compute options via a function (not a static memo) so test contexts see new registrations. - Export a `createCommandDialog` factory so tests can instantiate without JSX. ## Acceptance criteria - No crash when any `command.register` returns `undefined` or contains undefined entries. - Keybind footer strings render correctly for options with a `keybind`. ## Test plan - `cd packages/agent-core` - `bun test test/cli/tui/dialog-command.test.ts`
yindo added the opentui label 2026-02-16 18:05:24 -05:00
yindo closed this issue 2026-02-16 18:05:24 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 19, 2026):

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

  • #9470: Add regression test for command dialog option filtering (directly related - proposes adding tests for this same feature)
  • #6538: Mouse scrolling and selecting on dialog-command.tsx (ctrl+p) is broken (related to dialog-command component)
  • #6016: [BUG] Keybinds execute in background when dialogs/pickers are open (related to keybind handling in dialogs)

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

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

@github-actions[bot] commented on GitHub (Jan 19, 2026): This issue might be a duplicate of existing issues. Please check: - #9470: Add regression test for command dialog option filtering (directly related - proposes adding tests for this same feature) - #6538: Mouse scrolling and selecting on dialog-command.tsx (ctrl+p) is broken (related to dialog-command component) - #6016: [BUG] Keybinds execute in background when dialogs/pickers are open (related to keybind handling in dialogs) Feel free to ignore if none of these address your specific case. For keybind-related issues, please also check our pinned keybinds documentation: #4997
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6831