Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix(group_chat): commander dispatch-only fallback turn now writes a visible bubble
aiservice5b1a4c9942dc
diff --git a/src/main/features/group_chat/bus.ts b/src/main/features/group_chat/bus.tsindex 7ea5179f..5d6e24f0 100644--- a/src/main/features/group_chat/bus.ts+++ b/src/main/features/group_chat/bus.ts@@ -1056,6 +1056,36 @@ async function runTurn(state: CidState, w: WorkerState, item: QueueItem): Promis}}+ // Same UX rationale as the plan announcement merge: a commander turn+ // that ONLY emitted dispatch_to(s) leaves an empty bubble below the+ // process rail, which reads as "broken" to the user. Surface a brief+ // summary line so the bubble is informative. Skipped when there's+ // already a body (the LLM wrote prose alongside the dispatch — common+ // for fallback flows), and when the bubble already carries the plan+ // card from the merge above.+ // "Visually empty" — also strips zero-width chars some LLMs emit as the+ // body of a tool-only turn to dodge the framework's "empty response"+ // detection (we've seen U+200B as a single-char body alongside a+ // dispatch_to call). `.trim()` alone wouldn't catch them.+ // U+200B–U+200D (ZWSP / ZWNJ / ZWJ) + U+FEFF (BOM).+ const _isVisuallyEmpty = (s: string | undefined): boolean =>+ !s || !s.replace(/[-]/g, '').trim();+ if (actor.kind === 'commander'+ && w.pendingDispatches && w.pendingDispatches.length+ && outcome.kind === 'persist'+ && _isVisuallyEmpty(outcome.text)) {+ const tags: string[] = [];+ for (const d of w.pendingDispatches) {+ let name = d.to;+ try {+ const ag = await agentsFeat.getAgent(d.to);+ if (ag && (ag as any).name) name = (ag as any).name;+ } catch { /* fall back to raw id */ }+ tags.push('@' + String(name).replace(/\s+/g, ''));+ }+ outcome = { ...outcome, text: t('chat.commander_dispatch_only', { agents: tags.join(', ') }) };+ }+// Abort post-processing — single source of truth for both "promote silent// to persist when there's still something visible to keep" AND the// "(已中断)" suffix.diff --git a/src/main/locales/en.json b/src/main/locales/en.jsonindex fc546493..0f40e65c 100644--- a/src/main/locales/en.json+++ b/src/main/locales/en.json@@ -74,6 +74,7 @@"model.retrying_n": "Retry attempt {attempt}","model.aborted": "(stopped)","cli_agent.missing": "⚠️ Agent “{name}” needs the local CLI “{cli}” which isn’t installed. Install it and retry, or switch the agent to another type.",+ "chat.commander_dispatch_only": "Forwarded to {agents}.","plan.announcement.heading": "I'll proceed with the following steps:","plan.announcement.assignee_self": "me","plan.announcement.assignee_user": "you",diff --git a/src/main/locales/zh.json b/src/main/locales/zh.jsonindex 9e556ed9..7115a508 100644--- a/src/main/locales/zh.json+++ b/src/main/locales/zh.json@@ -74,6 +74,7 @@"model.retrying_n": "正在第 {attempt} 次重试","model.aborted": "(已中断)","cli_agent.missing": "⚠️ 智能体「{name}」依赖的本地 CLI「{cli}」未安装。请安装该 CLI 后重试,或在编辑面板换成其他类型。",+ "chat.commander_dispatch_only": "已转给 {agents}。","plan.announcement.heading": "我准备按下面的步骤推进:","plan.announcement.assignee_self": "我自己","plan.announcement.assignee_user": "请你",diff --git a/test/main/features/local_agents/codex_parser.test.ts b/test/main/features/local_agents/codex_parser.test.tsnew file mode 100644index 00000000..cf146026--- /dev/null+++ b/test/main/features/local_agents/codex_parser.test.ts@@ -0,0 +1,25 @@+import { describe, it, expect } from 'vitest';+import { extractThreadId } from '../../../../src/main/features/local_agents/backends/codex';++describe('local_agents/backends/codex › extractThreadId', () => {+ it('returns top-level threadId when present', () => {+ expect(extractThreadId({ threadId: 'th-1', other: 1 })).toBe('th-1');+ });++ it('falls back to nested .thread.id', () => {+ expect(extractThreadId({ thread: { id: 'th-2' } })).toBe('th-2');+ });++ it('returns undefined for missing / malformed input', () => {+ expect(extractThreadId(null)).toBeUndefined();+ expect(extractThreadId(undefined)).toBeUndefined();+ expect(extractThreadId({})).toBeUndefined();+ expect(extractThreadId({ threadId: '' })).toBeUndefined();+ expect(extractThreadId({ threadId: 42 as any })).toBeUndefined();+ expect(extractThreadId({ thread: { id: 0 as any } })).toBeUndefined();+ });++ it('prefers top-level over nested when both present', () => {+ expect(extractThreadId({ threadId: 'top', thread: { id: 'nested' } })).toBe('top');+ });+});diff --git a/test/main/features/local_agents/openclaw_parser.test.ts b/test/main/features/local_agents/openclaw_parser.test.tsnew file mode 100644index 00000000..6ceca1f2--- /dev/null+++ b/test/main/features/local_agents/openclaw_parser.test.ts@@ -0,0 +1,80 @@+import { describe, it, expect } from 'vitest';+import { parseOpenclawReply } from '../../../../src/main/features/local_agents/backends/openclaw';++describe('local_agents/backends/openclaw › parseOpenclawReply', () => {+ it('returns null for empty input', () => {+ expect(parseOpenclawReply('')).toBeNull();+ expect(parseOpenclawReply(' ')).toBeNull();+ });++ it('extracts text + sessionId from a typical openclaw stderr trail', () => {+ const stderr = `[skills] Skipping skill path that resolves outside its configured root.+[tools] read failed: ENOENT+{+ "payloads": [+ { "text": "你好。", "mediaUrl": null }+ ],+ "meta": {+ "durationMs": 17149,+ "agentMeta": {+ "sessionId": "abc-123",+ "provider": "openai-codex",+ "model": "gpt-5.4"+ }+ }+}`;+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('你好。');+ expect(r?.sessionId).toBe('abc-123');+ });++ it('joins multiple payloads with newline', () => {+ const stderr = `{+ "payloads": [+ { "text": "first" },+ { "text": "second" }+ ],+ "meta": { "agentMeta": { "sessionId": "s" } }+}`;+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('first\nsecond');+ });++ it('strips ANSI color escapes before parsing', () => {+ // Real openclaw injects ANSI on log prefixes; the JSON envelope+ // doesn't usually have them, but the function must not break if+ // some upstream future version adds them.+ const stderr = '[36m[skills][39m noise\n{ "payloads": [{ "text": "ok" }], "meta": {} }';+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('ok');+ });++ it('ignores partial / nested JSON noise before the final envelope', () => {+ const stderr = `[tools] {"path":"/x"} read failed+[tools] partial { not closed+{+ "payloads": [{ "text": "final reply" }],+ "meta": {}+}`;+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('final reply');+ });++ it('returns null when no shape-matching JSON found', () => {+ expect(parseOpenclawReply('just some logs, no json')).toBeNull();+ expect(parseOpenclawReply('{"unrelated":42}')).toBeNull();+ });++ it('surfaces error envelope when openclaw reports a failure', () => {+ const stderr = '{"error":"auth required"}';+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('');+ expect(r?.error).toBe('auth required');+ });++ it('handles strings with braces inside (no false brace match)', () => {+ const stderr = `{ "payloads": [{ "text": "code: { foo: { bar } }" }], "meta": {} }`;+ const r = parseOpenclawReply(stderr);+ expect(r?.text).toBe('code: { foo: { bar } }');+ });+});