Repository navigation
fix(openai): put the hybrid Responses breakpoint on OpenCode 2.3.2's developer system prompt - #51
Merged
Merged
Conversation
…eveloper system prompt
|
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.



OpenCode 2.3.2 moved the Responses system prompt out of
instructionsand into a leading developer message, because GPT-6.2 never cachesinstructions(anomalyco/opencode#64542, #64544). Merging this also releases 0.8.3. This PR keepshybrid's 12h breakpoint at the end of that system prompt, including when anadditional_toolsitem comes first.The problem
On the Responses wire,
hybridput its 12h breakpoint on the firstinputitem, whatever its role, becauseinstructionsis a plain string that can't carry one. With 2.3.2 that first item is now the system prompt itself, which happens to be the right spot. Two cases still went wrong:capabilities.tools.updatesincludes"add"): OpenCode puts anadditional_toolsitem before the system prompt. The first item then isn't a message, sohybridplaced no breakpoint and stripped any existing one. This was already broken before 2.3.2.The change
responsesPrefixText(src/services/openai-responses-cache.ts): it skips leadingadditional_toolsitems, then returns the lastinput_textof the leading developer/system messages. Wheninputdoesn't start with such a message (older OpenCode, which sendsinstructions), it falls back to the old first-item rule, so pre-2.3.2 bodies are unchanged.firstInputItemis removed, since this was its only caller.1h, pings and the strip-then-mark rewrite are untouched. A breakpoint from an older first-user placement moves to the developer message.hybridand1hcells indocs/SUPPORTED_PROVIDERS.mdandREADME.mdnow describe the developer-message shape.Probe: OpenAI honours a breakpoint on a developer message
The code comments only covered user and system messages, so I checked developer messages live. I sent Responses requests through OpenRouter on
openai/gpt-6-luna. The whole probe cost under $0.01.input_textinput_text(control)OpenRouter doesn't pass through the
ttl_12h_tokenssplit, so the 12h write is inferred from the doubled write price.Worth checking
npm package tarball > contains exactly the ship settimed out on the first CI run: it built and packed the tarball inside the test, which took 5.02s against Bun's 5s default (0.9–2.7s on earlier runs). Packing now runs once in abeforeAllwith a 60s timeout./responses/compactis still unmanaged. It doesn't match the/responsespath check, same as before, so the plugin doesn't touch it.Testing
responsesPrefixText: the developer prompt,additional_tools, walking back within the prefix run, a prefix run with no text, a mid-conversation developer message, and the pre-2.3.2 shape.openai.property.test.tsis updated to the new rule, and the arbitraries now generateadditional_toolsitems. Run atFC_NUM_RUNS=5000.tests/middleware/request.test.tsforhybridon the 2.3.2 shape.bun run fmt:check,bun run lint,bun run typecheckandbun testpass (1297 tests).