Fix OpenCode plugin Jinja template corruption with Qwen3.6 - #1114
Fix OpenCode plugin Jinja template corruption with Qwen3.6#1114atomicflag 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.
Review (at
|
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)