Skip to content

Conversation

@will-marella
Copy link
Contributor

@will-marella will-marella commented Dec 30, 2025

Summary

Adds /unqueue slash command to remove queued messages without affecting the current assistant response. It also adds a keybind, "session_unqueue" (default: none), so it can be easily configured by users.

Problem

Oftentimes after queueing a message, I decide I want to rewrite it or ask something else altogether. In these cases, I’d like to remove all queued messages from the queue.

Solution

The /unqueue command:

  • Removes queued user messages
  • Deletes them from persistent storage (clean conversation history)
  • Rejects in-memory callbacks (messages never execute)
  • Silent operation (no UI clutter)

Demo

opencode-easyunqueue.mp4

I experimented with introducing an interactable button in the TUI. (Imagine hovering over the QUEUED button and it prompts you to UNQUEUE) But this approach keeps the implementation simple and focused

@ariane-emory
Copy link
Contributor

Neat. There's no way I'm typing a long command name like that by hand, though, I would want the ability to bind it to a key (although the default bindings should be "none", allowing users to bind it to a key it they so choose). Likely only requires adding a couple of lines.

Will@Cambridge added 4 commits December 29, 2025 21:14
- Replace full message array accumulation with streaming iteration
- Stop at first assistant message (boundary optimization)
- Only store message IDs instead of full objects
- Use parallel deletion with Promise.all
- Memory: ~200KB → ~150 bytes (1000x reduction)
- I/O: Load 1-10 messages instead of 100+ (early break)
- Code: Only +6 lines for massive performance gain
…leUnqueue

- Rename queuedIDs -> queued (single-word preference per style guide)
- Remove let foundPending by moving deletion into conditional
- Add comment documenting MessageV2.stream order assumption
- Follows style guide: avoid let statements where possible
@will-marella
Copy link
Contributor Author

Neat. There's no way I'm typing a long command name like that by hand, though, I would want the ability to bind it to a key (although the default bindings should be "none", allowing users to bind it to a key it they so choose). Likely only requires adding a couple of lines.

You're right, that should be supported. I've updated the PR.

@Mishkun
Copy link

Mishkun commented Dec 30, 2025

this will fix #4821

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.

3 participants