Files
backnotprop__plannotator/apps/opencode-plugin/plan-mode.ts
Andrew bb6a65ac76 Fix OpenCode plugin Jinja template corruption with Qwen3.6 (#1114)
* fix(plugin): consolidate system prompt injections into single array element

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.

* refactor(opencode-plugin): extract composeSystemPrompt helper to centralize system prompt assembly and add unit tests

* style(opencode-plugin): remove extra newline before plan submission reminder heading

* fix(opencode-plugin): store composed prompt result before clearing system array to prevent data loss

Previously, `output.system` was cleared with `length = 0` before being passed into `composeSystemPrompt`, causing the function to compose from an empty array instead of the original system content. The fix stores the composition result in a variable first, then pushes it after clearing. Additionally, add `.trim()` in `stripConflictingPlanModeRules` to normalize whitespace before filtering empty entries, and include a test case for empty string collapse behavior.

* refactor(plan-mode.ts): move string trimming from stripConflictingPlanModeRules to composeSystemPrompt for centralized whitespace handling

* test(plan-mode): add test case for trimming trailing newlines in composeSystemPrompt
2026-08-10 10:09:58 -07:00

2.3 KiB