Repository navigation
fix(tui): defer queued agent and model selection until delivery - #54779
pedropombeiro wants to merge 4 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
This fixes the problem. I checked it with opencode-drive and the simulated model: during a Build turn held on a shell call, I pressed Shift+Tab to Plan and queued a prompt with Ctrl+X, Enter. On the base, the session switches to Plan at once and the rest of the running Build turn finishes as Plan. With this PR the running turn stays on Build, and the switch to Plan happens only when the queued prompt is delivered. /queue <message> behaves the same way. The 22 core runner tests matching "queued" pass, the server queue test passes, and the core and TUI type checks are clean.
Public API changes, all additions and backwards compatible:
POST /session/{id}/promptandPOST /session/{id}/commandaccept optionalagentandmodel(withvariant). The same fields are added to the generated client'sSessionPromptInput/SessionCommandInputand to the OpenAPI spec.Session.Inbox.UserPayloadgains optionalagentandmodel, which are stored with the inbox entry.- The plugin
CommandInvocation.prompt(effect and promise) gains optionalagentandmodel. - The TUI adds a built-in
/queue <message>command. It takes priority over any user-configured command namedqueue. - One behaviour change: configured commands with an
agent/model, sent withdelivery: "queue", no longer switch the session straight away.
The main thing to fix: the new TUI test's unavailable case is flaky (see the inline comment). One behaviour to note: the API also accepts agent/model on steer delivery, which then switches the agent or model mid-turn. If that isn't intended, please reject or ignore these fields unless delivery is queue.
a65949d to
1a59bd9
Compare
627e8ab to
479d861
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |


Issue for this PR
Closes #48356.
Type of change
What does this PR do?
Fixes the existing queue interaction: selecting Plan and pressing Ctrl+X, then Enter no longer changes an active Build task. Queued prompts capture the selected agent, model, and variant and apply them when delivered. Configured commands queued with the keybinding use the same deferred selection.
The runner prepares the target selection before consuming the input. Failed preparation leaves it pending and cancellable. API callers can supply optional
agentandmodelfields; omitted fields retain existing behavior. Steered selections apply at the next safe step boundary.This PR does not add a
/queueslash command.How did you verify your code works?
bun run checkpassed across all 36 type-check tasks.Screenshots / recordings
The automated review includes before/after screenshots and confirms the queue-keybinding fix with a simulated model. Screenshots courtesy of the OpenCode review bot.
Checklist