Browse Source

fix: handle empty system array edge case

Guard against output.system being empty, which would produce a spurious
empty string element. Return empty array instead of [''] in that case.

Co-authored-by: greptile-apps[bot] <greptile-apps[bot]@users.noreply.github.com>
ReqX 3 months ago
parent
commit
4611f1d9f3
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/index.ts

+ 2 - 1
src/index.ts

@@ -595,7 +595,8 @@ const OhMyOpenCodeLite: Plugin = async (ctx) => {
       // 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.
-      output.system = [output.system.join('\n\n')];
+      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)