Repository navigation
Conversation
The subscription endpoint rejects assistant-message prefill ("does not
support assistant message prefill. The conversation must end with a user
message"). Only opencode's exact "Continue with your tasks." nudge was
handled, so any other assistant-tailed request - e.g. a resumed session
whose last saved turn was the assistant's - failed with a 400.
Drop the nudge as before, then append a minimal user turn after any
remaining assistant tail, keeping the assistant content.
opencode marks the tail message's last part with cache_control as the prompt-prefix breakpoint. The bridge stripped cache_control from every message text block, so a text-tailed request (a plain user turn, or a compaction request) had no breakpoint left and never read the warm prefix (cache_read 0); only tool-tailed requests were cached. Strip earlier text breakpoints but keep the tail one. No breakpoint is added, so the API's four-breakpoint cap still holds.
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.
Summary
Continue with your tasks.nudge was handled, so any other assistant-tailed request failed with a 400 — e.g. a resumed session whose last saved turn was the assistant's, or opencode's max-steps prefill. The nudge is still dropped; any other assistant tail now gets a minimalContinue.user turn appended, so the assistant content is kept.cache_controlbreakpoint. opencode puts its prompt-prefix breakpoint on the tail message's last part, and the bridge strippedcache_controlfrom every message text block, so text-tailed requests (plain user turns, compaction requests) never read the cached prefix (cache_read0) — only tool-tailed requests did. Earlier text breakpoints are still stripped and none is added, so the four-breakpoint cap still holds.This also fixes the max-steps prefill failure #26 is after; regression tests cover both its string and text-block shapes.
Test plan
npm testnpm run typecheckcache_read0 before this change).