Skip to content

TUI mini: prompt queue could grow unbounded #56175

Closed as not planned
Closed as not planned

Description

@Addin

Summary

mini/runtime.queue.ts:46-83 — prompt queue admits all ordinary prompts during an active turn to the durable queue, which could grow unbounded.

Root cause

// Ordinary prompts submitted during an ordinary active turn are admitted as
// durable queued work instead of remaining editable process-local state.

Suggested fix

Add a queue size limit or backpressure mechanism.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the report! As written, this describes what the code could do rather than a problem you actually ran into. In mini mode, the queue in runtime.queue.ts only grows from prompts you submit yourself while a turn is running. Prompts still held locally are dropped when the footer closes, and the rest go to the server's queue. So it's not clear yet when this would grow large enough to matter.

    To look into it, could you tell us:

    • Your OpenCode version (opencode --version), OS and terminal
    • What you did: the steps, e.g. how many prompts you queued and how
    • What happened as a result (high memory use, slowdown, errors, logs) and what you expected instead

    Please describe it briefly in your own words. You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.

    I didn't find a duplicate. The closest related issues, ordered by likelihood:

  2. Addin commented on Oct 16, 2026

    @Addin
    Author

    Thank you for the correction. Looking more carefully at packages/tui/src/mini/runtime.queue.ts:

    // Ordinary prompts submitted during an ordinary active turn are admitted as
    // durable queued work instead of remaining editable process-local state.

    And in close():

    const close = () => {
      if (state.closed) return
      state.closed = true
      state.queue.length = 0  // <-- queue is cleared on close
      ...
    }

    The local queue is:

    1. Only populated from prompts submitted during an active turn (which are admitted to the server's durable queue)
    2. Cleared when the footer closes (state.queue.length = 0)

    So the queue does NOT grow unbounded. I withdraw this issue (#56175).

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for double-checking, @Addin, and for the clear follow-up. Agreed: the local queue only holds prompts you submit during an active turn, and close() clears it, so it doesn't grow without limit.

    Since you've withdrawn it, feel free to close this issue yourself. Otherwise the bot will close it automatically in a few days. If you ever hit a real problem with queued prompts in mini mode (high memory use, slowdowns, errors), please open a new issue with your opencode --version, the steps, and what you saw.

  4. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Closing this as not planned. As you confirmed, @Addin, the mini-mode prompt queue in runtime.queue.ts doesn't grow without limit: it only holds prompts submitted during an active turn, and it's cleared when the footer closes. Thanks for checking it again. If you run into a real problem with queued prompts (high memory use, slowdowns, errors), please open a new issue with your opencode --version, the steps, and what you saw.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions