Skip to content

[FEATURE]: Graceful handling of queued messages after session interrupt #5333

Closed

Description

@thoughtlesslabs

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem

When a user sends multiple messages while an operation is in progress, the messages are queued. However, if the current operation is interrupted (aborted), the queued messages are silently rejected and lost rather than being processed. This creates a poor user experience, especially when iterating quickly with the AI assistant.

Current behavior:

current-queue-system.mp4
  • User sends message A (starts processing)
  • User sends message B while A is processing (queued)
  • User interrupts message A
  • Message B is silently discarded ❌

Expected behavior:

  • User sends message A (starts processing)
  • User sends message B while A is processing (queued)
  • User interrupts message A
  • Message B begins processing automatically ✅

Proposed Solution

This feature adds graceful queue handling with full visibility and control:

Screen.Recording.2025-12-10.at.1.47.19.PM.mov

1. Queue Persistence After Interrupts

Queued messages remain in the queue and are processed in order after an interrupt, rather than being rejected.

2. Cancel Individual Queued Messages

Users can remove specific messages from the queue via the message action dialog (click on a queued message to see the "Cancel" option).

Image

3. Separated Queue Display

Queued messages are pinned in a dedicated section above the input prompt, visually separated from the scrolling conversation. A "Processing next task..." separator shows when tasks transition.

Image

Implementation

A working implementation is available in the fork branch:

🔗 https://github.com/thoughtlesslabs/opencode/tree/feat/queued-message-interrupt

Key Changes

File Description
packages/opencode/src/session/prompt.ts Queue handling logic with loopId tracking to prevent race conditions, cancelQueued() and getQueuedMessageIds() functions
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx Visual queue separation with queuedMessages and activeMessages memos, pinned queue section
packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx Cancel action for queued messages in the message dialog

Technical Details

  • Added loopId tracking using ulid() to prevent race conditions when canceling/restarting loops
  • Queue callbacks now include userMessageID for proper tracking
  • processQueuedCallbacks() handles ordered queue processing after interrupts
  • UI uses SolidJS reactive memos for efficient queue state management

Why It Belongs in OpenCode

  1. Improves UX - User input is never silently discarded
  2. Provides transparency - Users can see exactly what's queued and processing
  3. Gives users control - Ability to cancel individual queued messages
  4. Common workflow - Users frequently iterate quickly, sending follow-up messages before the AI finishes
  5. No breaking changes - Backward compatible enhancement to existing behavior

This feature request follows the CONTRIBUTING.md guidelines for net-new functionality.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Dec 10, 2025
  2. github-actions commented on Dec 10, 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. thoughtlesslabs commented on Dec 10, 2025

    @thoughtlesslabs
    Author

    I do understand that there are some other related issues raised, but i put this as a new one because it provides a comprehensive solution and I wanted to submit this is a feature request instead of a bug fix because it introduces updated ui/ux elements

  4. self-assigned this
    on Dec 10, 2025
  5. rekram1-node commented on Dec 10, 2025

    @rekram1-node
    Collaborator

    I see...

  6. thoughtlesslabs commented on Dec 23, 2025

    @thoughtlesslabs
    Author

    Hey @rekram1-node what would next steps be on this? Push as a pr?

  7. rekram1-node commented on Dec 23, 2025

    @rekram1-node
    Collaborator

    The proposal sounds a bit more complicated than what i'd expect but I havent looked into this particular issue enough.

    It seems like there is prolly a simple fix so that a queued message would be persisted to disk

  8. thoughtlesslabs commented on Jan 13, 2026

    @thoughtlesslabs
    Author

    @rekram1-node the fix i originally put forward still did some weird things, but was definitely simpler. I can close these ones and figure out a better solution. It's funny how often i run into this, but I queue messages quite a bit. And also interrupt actions when i can see things going off the rails.

  9. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  10. robclancy commented on Mar 25, 2026

    @robclancy

    I used opencode for a month and this always annoyed me. Then I tried out claude code and this single change is the biggest reason I will keep using it. Currently rate limited so back for a bit but this change has instantly annoyed me again.

  11. epicwhale commented on Jun 5, 2026

    @epicwhale

    I used opencode for a month and this always annoyed me. Then I tried out claude code and this single change is the biggest reason I will keep using it. Currently rate limited so back for a bit but this change has instantly annoyed me again.

    agree this feels like quite a solved problem and user expectation in claude code, and would be a great quality of life improvement in opencode!

    there's literally no way to undo a queued message :( without aborting the whole turn!

  12. aikomputeapi-web commented on Aug 9, 2026

    @aikomputeapi-web

    what on earth is the excuse for taking sooooo long for such an obvious fix...... this was annoying, but now learning how this issue is being handled has convinced me to find an alternative cli tool quickly... very sad to see.

    jcode seems like an interesting new entrant to the harness engineering game, we'll see how it matures, but im excited so far..... anything to get off this horribly maintained codebase..... bye opencode

  13. 7heMech commented on Aug 21, 2026

    @7heMech

    Dudee

  14. stuible commented on Sep 15, 2026

    @stuible

    Really would love this addressed

  15. robclancy commented on Sep 15, 2026

    @robclancy

    I'm pretty sure it works like this on opencode2 btw. Last night when I pressed escape it seemed to be picking up what I had there but out of habit I never waited so not 100% sure.

    If this issue wasn't stupidly closed they probably would have it linked to the feature.

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions