Skip to content

[BUG] Autocomplete dropdown conflicts with permission dialog - visual overlap and keyboard event capture #5820

Closed

Description

@anntnzrb

Description

When the autocomplete dropdown (@ for files/agents or / for commands) is open and a permission request arrives (e.g., tool approval for bash/edit), there is a visual and functional conflict:

  1. Visual conflict: The autocomplete dropdown (zIndex={100}) visually overlaps and covers the permission options rendered inline in the messages area, making it impossible to see what permission is being requested.

  2. Keyboard conflict: Both components capture the same keys:

    • Autocomplete: escape, enter, tab, up, down
    • Permission dialog: enter (accept once), a (always), d (deny), escape (reject)

The autocomplete processes keyboard events first, so when both are active, the permission dialog cannot receive input correctly.

Steps to Reproduce

  1. Start typing a message with @ or / to open the autocomplete dropdown
  2. While the dropdown is open, have the LLM trigger a tool that requires permission (e.g., bash command, file edit)
  3. Observe that:
    • The permission request appears behind/under the autocomplete dropdown
    • Keyboard shortcuts for accepting/denying the permission don't work as expected

Alternate scenario:

  1. Have the LLM running and generating content
  2. Start typing @ or / to open autocomplete
  3. A permission request arrives mid-interaction
  4. Cannot see the permission options while autocomplete is open

Expected Behavior

When a permission request arrives:

  • The autocomplete should close automatically (since the prompt is disabled anyway when permissions().length > 0)
  • OR the permission UI should have higher visual priority (z-index)
  • Keyboard events should be routed to the permission handler, not the autocomplete

Actual Behavior

  • The autocomplete remains visible and covers the permission options
  • Keyboard events are captured by the autocomplete, preventing permission responses
  • User must manually dismiss autocomplete (if possible) to interact with permissions

Technical Analysis

Relevant code locations:

  • packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx:420-439 - Autocomplete has zIndex={100} and no logic to close when permissions arrive
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx:197-218 - Permission keyboard handler checks for dialogs but not autocomplete state
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx:1001 - Prompt is disabled when permissions pending, but autocomplete isn't notified
  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx:764 - Autocomplete processes onKeyDown before other handlers

Proposed Solution

The simplest fix would be to close the autocomplete when permissions are pending:

  1. Pass a disabled or hidden prop to Autocomplete component
  2. When permissions().length > 0, set this prop to true
  3. In Autocomplete, call hide() when this prop becomes true

This aligns with the existing behavior where the prompt is already disabled during permission requests.

OpenCode version

Latest

Operating System

Any

Terminal

Any

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 19, 2025
  2. github-actions commented on Dec 19, 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. rekram1-node commented on Dec 19, 2025

    @rekram1-node
    Contributor

    Dax is reworking permissions stuff inclduing UI, this shoudl be fixed soon

  4. anntnzrb commented on Dec 19, 2025

    @anntnzrb
    ContributorAuthor

    Thanks for the quick response @rekram1-node! Good to know this is already being addressed in the permissions UI rework.

    I'll keep an eye on the related issues (#3455, #4092) for updates. Feel free to close this if it's covered by the upcoming changes.

  5. rekram1-node commented on Dec 20, 2025

    @rekram1-node
    Contributor

    ill leave open and see once his changes land if this is still an issue or not

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