Browse Source

Merge pull request #336 from ReqX/fix/315-system-message-collapse

Alvin 3 months ago
parent
commit
c2b0221b3d
2 changed files with 8 additions and 1 deletions
  1. 1 1
      src/hooks/todo-continuation/todo-hygiene.test.ts
  2. 7 0
      src/index.ts

+ 1 - 1
src/hooks/todo-continuation/todo-hygiene.test.ts

@@ -86,7 +86,7 @@ describe('todo hygiene', () => {
     await hook.handleChatSystemTransform({ sessionID: 's1' }, system);
 
     expect(
-      system.system.filter((item) => item === TODO_HYGIENE_REMINDER),
+      system.system.filter((item) => item.includes(TODO_HYGIENE_REMINDER)),
     ).toHaveLength(1);
   });
 

+ 7 - 0
src/index.ts

@@ -590,6 +590,13 @@ const OhMyOpenCodeLite: Plugin = async (ctx) => {
         input,
         output,
       );
+
+      // Collapse to single system message for provider compatibility.
+      // Some providers (e.g. Qwen3.5 via DashScope) reject multiple system
+      // messages. Sub-hooks above may push additional entries; join them
+      // back into one element so OpenCode emits a single system message.
+      const joined = output.system.join('\n\n');
+      output.system = joined ? [joined] : [];
     },
 
     // Inject phase reminder and filter available skills before sending to API (doesn't show in UI)