Fix OpenCode plugin Jinja template corruption with Qwen3.6#1114
Open
atomicflag wants to merge 1 commit into
Open
Fix OpenCode plugin Jinja template corruption with Qwen3.6#1114atomicflag wants to merge 1 commit into
atomicflag wants to merge 1 commit into
Conversation
…lement The plugin previously pushes planning prompts and improvement contexts as separate elements in the output.system array. This change appends them to output.system[0] with newline separators instead. This keeps all system instructions within a single message block to prevent potential parsing or formatting issues when the agent processes the context.
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.
Issue
The OpenCode plugin's
system.transformhook was corrupting OpenCode's Jinja template when injecting planning prompts. The error appeared as:This occurred when using Qwen3.6 models with their chat template.
Root Cause
The plugin was pushing planning prompts and improvement context as separate elements in the
output.systemarray:OpenCode maps each element of
output.systemto a separate system message. The Qwen3.6 Jinja template only allows one system message at position 0:When the plugin pushed multiple elements, OpenCode created multiple system messages, causing the template to fail at position > 0.
Jinja template reference: https://huggingface.co/Qwen/Qwen3.6-35B-A3B-FP8/raw/main/chat_template.jinja
Solution
Instead of pushing new elements to
output.system, the plugin now appends content to the first element (output.system[0]):This preserves the multi-message
output.systemarray structure while keeping all injected content within the original system message (element 0). The Jinja template sees only one system message at position 0, containing all the plugin's additions.Testing
plan-mode.test.ts)