Repository navigation
fix(opencode-plugin): stop the v2 prompt hook from holding the send on recall - #5496
Open
oliver-mee wants to merge 2 commits into
Open
oliver-mee wants to merge 2 commits into
oliver-mee wants to merge 2 commits into
Conversation
oliver-mee
force-pushed
the
ov-opencode-v2-nonblocking-recall
branch
4 times, most recently
from
October 9, 2026 09:02
4fc7a22 to
8168c7b
Compare
oliver-mee
force-pushed
the
ov-opencode-v2-nonblocking-recall
branch
from
October 31, 2026 20:46
8168c7b to
f8ccb6f
Compare
Author
|
Refreshed on current main Refresh assisted by GPT-6.1 Sol. |
7 of 21 tasks
oliver-mee
force-pushed
the
ov-opencode-v2-nonblocking-recall
branch
from
November 10, 2026 09:49
f8ccb6f to
ce66cad
Compare
Merged
10 of 21 tasks
oliver-mee
force-pushed
the
ov-opencode-v2-nonblocking-recall
branch
from
November 18, 2026 05:10
ce66cad to
314fe8d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On OpenCode v2, a sent message can sit unsubmitted while OpenViking retrieves memories. OpenCode awaits the plugin's
prompthook before admitting the message. After #7582, the session-start and recall requests already run concurrently, but the hook still awaits both. Holding the recall response open on a clean OpenCode 2.3.0 install reproduces the delay.This moves the wait to
context, which runs immediately before the model request. Theprompthook starts both requests and returns. The message is admitted while recall is in flight. The model request still gets the context that arrives within the configured budget.OpenCode rebuilds that model context on every request. The plugin records the injected text by message so a later request, including one after a restart, can use identical bytes and preserve the provider's prefix cache. Prior releases stored the same information in prompt metadata, which this path still reads.
Human Involvement
Related Issue
Fixes #5148.
Part of #5494. Builds on the parallel fetches in #7582 and follows the replay approach from #4137.
Type of Change
Changes Made
lib/v2-recall.mjs. Start therecallWaitMsclock when theprompthook starts, with a default of 5000 ms. Skip per-message recall that arrives after the budget and carry late session-start context to the next message.recallLedger: falsekeeps replay state in memory.tests/v2-recall.test.mjs.Testing
On macOS with Node 24.21.0, the OpenCode plugin suite passed 67 tests on
314fe8d0e. The plugin syntax, shared sync and all seven version checks passed.In a packed OpenCode 2.3.0 loopback test, the base
674e07f2aheld the prompt while recall was blocked. This head admitted the message before the response was released, then included the returned text in the first model request. A second turn after restarting OpenCode replayed the first user message byte for byte. The fixture recorded just one fetch for the original query.The broader shared suite hit a Desktop launcher assertion in
install-tui.test.mjsthat also fails on the pristine base. The runtime test used a local provider fixture.Checklist
Additional Notes
The model request keeps the remaining recall wait, so this is a prompt-admission improvement. The budget still controls how long slow retrieval can delay the first model token.
Developed with AI agents, with a human in the loop. Models: Claude Opus 5.5, GPT-6.1 Sol, and GPT-6.2 Sol.