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
Heal orphan group chat loading state
wyt1e56a0970c48
diff --git a/src/main/features/group_chat/index.ts b/src/main/features/group_chat/index.tsindex 8381b2d5..352ba71c 100644--- a/src/main/features/group_chat/index.ts+++ b/src/main/features/group_chat/index.ts@@ -42,8 +42,16 @@ export async function runtimeStatus(try {const state = await readState(userId, cid);const runtime = runtimeSnapshot(userId, cid);+ const diskInFlight = Array.isArray(state.in_flight)+ ? state.in_flight.filter(Boolean)+ : [];+ if ((state.status === 'running' || diskInFlight.length > 0) && !runtime.processing) {+ log.warn(`healing orphan running state user=${userId} cid=${cid} status=${state.status} in_flight=${diskInFlight.join(',')}`);+ await setStatus(userId, cid, 'idle');+ return { processing: false, processing_since: null, in_flight: [], active_turns: [] };+ }const inFlight = Array.from(new Set([- ...(Array.isArray(state.in_flight) ? state.in_flight : []),+ ...diskInFlight,...runtime.inFlight,].filter(Boolean)));const processing = state.status === 'running' || inFlight.length > 0 || runtime.processing;diff --git a/test/main/features/group_chat/state.test.ts b/test/main/features/group_chat/state.test.tsindex 84d3f151..b36d52d2 100644--- a/test/main/features/group_chat/state.test.ts+++ b/test/main/features/group_chat/state.test.ts@@ -212,3 +212,24 @@ describe('group_chat state › touchActivity (stuck-turn watchdog heartbeat)', (}});});++describe('group_chat facade › runtimeStatus orphan recovery', () => {+ it('heals persisted running/in_flight state when no worker exists in this process', async () => {+ const s = await import('../../../../src/main/features/group_chat/state');+ await s.setStatus(TEST_UID, TEST_CID, 'running');+ await s.markInFlight(TEST_UID, TEST_CID, 'commander', true);++ const facade = await import('../../../../src/main/features/group_chat');+ const runtime = await facade.runtimeStatus(TEST_UID, TEST_CID);+ expect(runtime).toEqual({+ processing: false,+ processing_since: null,+ in_flight: [],+ active_turns: [],+ });++ const healed = await s.readState(TEST_UID, TEST_CID);+ expect(healed.status).toBe('idle');+ expect(healed.in_flight).toEqual([]);+ });+});