Skip to content

Conversation

@aweis89
Copy link
Contributor

@aweis89 aweis89 commented Jan 11, 2026

Summary

Adds support for the mcp_question tool which allows the AI to ask users questions during execution. Previously, when OpenCode used the question tool, the UI would just hang.

Changes

  • Add API client methods for question endpoints (list_questions, reply_question, reject_question)
  • Add question event types (question.asked, question.replied, question.rejected)
  • Add question picker UI component using base_picker
  • Add question icon to icon presets
  • Wire up question.asked event handler in renderer
  • Fix Snacks picker not closing after multi-select action

How it works

  1. When the AI calls the question tool, opencode emits a question.asked event
  2. The plugin receives this event and shows a picker UI via base_picker
  3. The full question text is displayed in both:
    • A vim.notify notification (for visibility, may auto-dismiss)
    • The picker title (stays visible while picker is open)
  4. User selects options using their configured picker (Snacks, Telescope, fzf-lua, or mini.pick)
  5. For multi-select questions, users can toggle selections with Tab and confirm with Enter
  6. The answer is sent back via the reply API endpoint

Bug fix

Fixed an issue in base_picker where Snacks picker wouldn't close after confirming a multi-select action. Custom actions now properly collect selected items before closing the picker.

Features

  • Single-select questions (Enter to confirm)
  • Multi-select questions (Tab to toggle, Enter to confirm selection)
  • "Other" option for custom text input via vim.ui.input
  • Cancel/escape rejects the question
  • Works with all supported pickers (Snacks, Telescope, fzf-lua, mini.pick)

- Add API client methods for question endpoints (list, reply, reject)
- Add question event types (question.asked, question.replied, question.rejected)
- Add question picker UI that shows full question as notification and uses
  short header as prompt to avoid truncation
- Support single-select and multi-select questions with 'Other' option
- Add question icon to icon presets
- Wire up question.asked event handler in renderer

This enables opencode.nvim to handle the mcp_question tool that allows
the AI to ask users questions during execution.
@aweis89 aweis89 marked this pull request as draft January 11, 2026 20:20
- add support for multi-selection with confirmation action
- introduce dynamic input handling for "Other" responses
- refactor user feedback notifications for better context
- utilize base_picker for streamlined option formatting and selection

Closes sudo-tee#123
@aweis89 aweis89 marked this pull request as ready for review January 12, 2026 01:14
Copy link
Owner

@sudo-tee sudo-tee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great.

I didn't even know it was possible. Opencode moves so fast it's hard to follow.

I left a couple of notes about AI comments. I am not a fan of adding comments for obvious things.

I encountered an issue where if I hit escape after a question The plugin ends up in infinite Thinking...

A part from that code loooks clean

- add logic to ensure callbacks are invoked when selections are made
- handle cases where selection is cancelled to call callback with nil
- update multiple UI components (telescope, mini_pick, snacks) for consistency
- improve user experience by managing selection states effectively
- clarify that comments should explain *why* something is done, not *what*
- emphasize avoiding obvious comments that restate code functionality
@aweis89 aweis89 requested a review from sudo-tee January 12, 2026 16:49
@sudo-tee sudo-tee merged commit 0ed1411 into sudo-tee:main Jan 12, 2026
5 checks passed
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.

2 participants