Skip to content

Adding queue edit support - #11

Merged
mirsella merged 6 commits into
mirsella:mainfrom
ClemCa:main
Nov 1, 2026
Merged

mirsella merged 6 commits into
mirsella:mainfrom
ClemCa:main

Conversation

@ClemCa

@ClemCa ClemCa commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

As mentioned in issue #10

For usage, I settled on the simplest alternative to avoid touching too much of the project and make the review simpler. It should also keep it in line with the style of the rest of the plugin.

I chose to drop attachments when the entry kind changes to match earlier code (in engine, a comment says "shell and compaction entries never carry attachments").

@mirsella

Copy link
Copy Markdown
Owner

Thanks for this! I tried it in opencode 2.2.5 (Docker, with a fake model). Text edits work well: numbered and last-entry edits, turning an entry into a shell command, keeping inherited files, the error messages, and replay sends the edited text. Unit tests, typecheck and the integration suite all pass.

One thing fails from the TUI: editing with a new attachment.

/queue:edit 2 summarize @notes.txt
→ Failed to run command: Mention is outside the submitted input

opencode gives the command handler only the text after the command name, but it still counts the attachment's position from the start of the full line. This is what execute() received:

{"name":"queue:edit","prompt":{"text":"2 summarize @notes.txt ","files":[{"uri":"file:///workspace/notes.txt","name":"notes.txt","mention":{"start":24,"end":34,"text":"@notes.txt"}}]}}

@notes.txt starts at 12 in that text, so the position is off by the length of /queue:edit . When the text is long enough, the check passes and the position silently points at the wrong characters instead.

This doesn't come from your change: plain /queue summarize @notes.txt fails the same way on main. The new tests don't catch it because they submit the full line through the RPC submit, where the positions do line up.

The fix probably belongs in the command handler in index.ts: shift the mention positions (files, agents, skills) back by the /<name> prefix before calling engine.submit, plus a test that sends the prompt the way the TUI command path does. It could go in this PR or a follow-up. Until then, the README line about replacing attachments in an edit won't work from the TUI.

I tested with an @file mention. I didn't try a pasted image, but it carries the same kind of position, so it's probably affected too.

@ClemCa

ClemCa commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Oh, good that it was caught then. I'll be looking to fix this either later or tomorrow then.
Thank you.

@ClemCa

ClemCa commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Should be good now. I don't know how to test it in opencode, so I tried to be thorough with the tests.

opencode keeps shell output in the session inbox until the next model
turn, so a shell-only queue never emits session.synthetic. Queue a
prompt after the edited shell entry and check that turn instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mirsella
mirsella merged commit 0ae0b13 into mirsella:main Nov 1, 2026
1 check passed
@mirsella

mirsella commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks a lot for this, and for turning the mention fix around so quickly! It's merged and released in v2.1.0.

Before merging I pushed one small commit to your branch (89f3df5). The new test that turns an edit into a shell timed out every time. opencode keeps shell output in the session inbox until the next model turn, so a queue that holds only a shell never emits session.synthetic. A plain /queue !printf on main does the same, so it wasn't your code. The test now queues a prompt after the shell and checks that turn.

I also tried your fix in the TUI with opencode 2.2.5. @file mentions in numbered and last-entry edits, extra spaces around the number, plain /queue … @file, and a pasted image all reached the model correctly.

@ClemCa

ClemCa commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks to you!
I'm not used to contributing to open source, especially with APIs I've never worked with, so I'm glad it went well.

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