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): always render a visible bubble when user pings commander directly
aiservicec29a3e1f4608
diff --git a/src/main/features/group_chat/bus.ts b/src/main/features/group_chat/bus.tsindex b93922e1..a09770f9 100644--- a/src/main/features/group_chat/bus.ts+++ b/src/main/features/group_chat/bus.ts@@ -1308,14 +1308,15 @@ async function buildCommanderExtraTools(state: CidState, w: WorkerState): Promisif (!stepsIn.steps.length) {return { content: JSON.stringify({ ok: false, error: 'empty or invalid steps (each step needs `title` + `assignee`)' }), isError: true };}- const { plan, firstTime } = await setPlan(uid, cid, stepsIn);+ const { plan } = await setPlan(uid, cid, stepsIn);emit(state, { type: 'plan_changed', cid });- if (firstTime) {- // Stage the announcement on the worker; runTurn end merges it into- // commander's turn-end message so thinking rail + plan card share- // a single bubble. See WorkerState.pendingPlanAnnouncement.- w.pendingPlanAnnouncement = formatPlanAnnouncement(plan);- }+ // Stage the announcement on the worker; runTurn end merges it into+ // commander's turn-end message so thinking rail + plan card share+ // a single bubble. See WorkerState.pendingPlanAnnouncement.+ // Always announce, including on re-plans — a silent re-plan would+ // leave the user with only the process rail (the "user pings+ // commander → must respond" invariant).+ w.pendingPlanAnnouncement = formatPlanAnnouncement(plan);// NOTE: dispatch is DEFERRED to runTurn-end (see bus.runTurn for the// post-outcome `planExecutor.reconcile` call). Doing it here would// mean the agent worker starts running while commander's own LLMdiff --git a/src/main/features/group_chat/plan.ts b/src/main/features/group_chat/plan.tsindex 3bec829d..5af414e0 100644--- a/src/main/features/group_chat/plan.ts+++ b/src/main/features/group_chat/plan.ts@@ -161,13 +161,13 @@ async function writePlanRaw(uid: string, cid: string, plan: PlanFile): Promise<v}/**- * Replace the entire plan. Returns whether this is the FIRST set for this- * conversation (used by bus to decide whether to also emit a group- * announcement message).+ * Replace the entire plan. Bus always emits an announcement on every+ * `plan_set` call (not just the first) — silent re-plans break the+ * "user pings commander → must respond" invariant.*/export async function setPlan(uid: string, cid: string, input: PlanSetInput,-): Promise<{ plan: PlanFile; firstTime: boolean }> {+): Promise<{ plan: PlanFile }> {const file = groupChatPlanFile(uid, cid);const existed = fs.existsSync(file);let created_at = nowIso();@@ -197,8 +197,8 @@ export async function setPlan(steps,};await writePlanRaw(uid, cid, plan);- log.info(`plan-set user=${uid} cid=${cid} steps=${steps.length} firstTime=${!existed}`);- return { plan, firstTime: !existed };+ log.info(`plan-set user=${uid} cid=${cid} steps=${steps.length} replan=${existed}`);+ return { plan };}export async function updateStep(diff --git a/src/main/features/group_chat/plan_executor.ts b/src/main/features/group_chat/plan_executor.tsindex 25927e05..9bce34cf 100644--- a/src/main/features/group_chat/plan_executor.ts+++ b/src/main/features/group_chat/plan_executor.ts@@ -246,10 +246,12 @@ function outcomeForSynthTurn(evt: TurnFinishedEvent): TurnOutcome {* user submits" (which arrives here as trigger=user_direct since the user* enqueue triggered the agent worker, not the executor).*- * commander empty-final special-case:- * - tool-only turn (`activityEvents > 0` + 'empty response') → silent- * - zero-activity empty + 'empty response' → ⚠️ failure (config / auth)- * - plain empty without errText → silent+ * commander empty-final policy: user_direct means the user is actively+ * waiting on commander, so silent is forbidden — even a tool-only turn+ * (e.g. only called dispatch_to / kb_search without writing a final)+ * must persist an empty bubble carrying the process rail. Otherwise the+ * user sees nothing after their message lands. Real config / auth errors+ * still surface as an errorBubble.** agent empty-final → always persist '(无回复)'.*/@@ -294,11 +296,14 @@ async function outcomeForUserDirectTurn(uid: string, cid: string, evt: TurnFinis}// Empty final, no side effects.if (evt.actor.kind === 'commander') {- const isSpuriousEmpty = evt.errText === 'empty response';- if (!evt.errText) return { kind: 'silent' };- if (isSpuriousEmpty && evt.activityEvents > 0) return { kind: 'silent' };- // Real failure (errText other than spurious, or zero-activity empty).- return { kind: 'persist', text: errorBubble(evt.errText || 'empty response') };+ // User pinged commander → must respond. Empty bubble still carries+ // the process rail (tool calls, dispatch_to progress) attached by bus.+ if (!evt.errText) return { kind: 'persist', text: '' };+ if (evt.errText === 'empty response' && evt.activityEvents > 0) {+ return { kind: 'persist', text: '' };+ }+ // Real failure (zero-activity empty, or other err).+ return { kind: 'persist', text: errorBubble(evt.errText) };}// agent empty + no side effects.if (evt.errText) return { kind: 'persist', text: errorBubble(evt.errText) };diff --git a/test/main/features/group_chat/plan.test.ts b/test/main/features/group_chat/plan.test.tsindex c60e211b..2e450db7 100644--- a/test/main/features/group_chat/plan.test.ts+++ b/test/main/features/group_chat/plan.test.ts@@ -23,7 +23,7 @@ afterEach(() => {});describe('group_chat plan', () => {- it('setPlan firstTime=true on first write, false on second', async () => {+ it('setPlan replaces the plan and preserves created_at across re-plans', async () => {const plan = await import('../../../../src/main/features/group_chat/plan');const r1 = await plan.setPlan(TEST_UID, TEST_CID, {steps: [@@ -31,9 +31,9 @@ describe('group_chat plan', () => {{ title: 'analyze', assignee: 'commander' },],});- expect(r1.firstTime).toBe(true);expect(r1.plan.steps).toHaveLength(2);expect(r1.plan.steps[0].title).toBe('gather data');+ const createdAt = r1.plan.created_at;const r2 = await plan.setPlan(TEST_UID, TEST_CID, {steps: [@@ -42,8 +42,8 @@ describe('group_chat plan', () => {{ title: 'report', assignee: 'commander' },],});- expect(r2.firstTime).toBe(false);expect(r2.plan.steps).toHaveLength(3);+ expect(r2.plan.created_at).toBe(createdAt);});it('updateStep flips status + applies patch fields', async () => {