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(local-agents): match only real stale-session errors
BlueSkyID6662a6afa14380a
diff --git a/src/main/features/local_agents/context.ts b/src/main/features/local_agents/context.tsindex 76756a24..ab7d333e 100644--- a/src/main/features/local_agents/context.ts+++ b/src/main/features/local_agents/context.ts@@ -44,10 +44,15 @@ export interface CliContextMaterialization {resumeFallbackPrompt: string;}+// A rejected resume drops the native session binding and restarts the CLI+// from bounded recovery, so a false match costs the user their working+// context. Match only the CLI's own stale-session phrasings: the failure+// word must sit next to the word "session" (optionally its id), not anywhere+// on a line that merely mentions a session file, flag, or module.const CLI_RESUME_REJECTED_PATTERNS = [/No conversation found with session ID/i,- /session.*(not found|does not exist|expired|invalid|unknown)/i,- /(not found|does not exist|expired|invalid|unknown).*session/i,+ /\bsession(?: id)?\b(?: [^\s]+)? (?:was |is |has )?(?:not found|does not exist|no longer exists|expired|invalid|unknown)\b/i,+ /\b(?:unknown|invalid|expired|stale|no such|missing) session(?: id)?\b/i,];export function isCliResumeRejectedMessage(value: unknown): boolean {diff --git a/test/main/features/local_agents/context.test.ts b/test/main/features/local_agents/context.test.tsindex 29cb808f..63f9ea6a 100644--- a/test/main/features/local_agents/context.test.ts+++ b/test/main/features/local_agents/context.test.ts@@ -186,6 +186,17 @@ describe('local_agents/context › semantic CLI context', () => {expect(isCliResumeRejectedMessage('No conversation found with session ID abc')).toBe(true);expect(isCliResumeRejectedMessage('session does not exist')).toBe(true);expect(isCliResumeRejectedMessage('unknown session abc')).toBe(true);+ expect(isCliResumeRejectedMessage('Error: session abc123 not found')).toBe(true);+ expect(isCliResumeRejectedMessage('session id 0f3a is invalid')).toBe(true);+ expect(isCliResumeRejectedMessage('resume failed: no such session')).toBe(true);expect(isCliResumeRejectedMessage('tests failed in session-manager.ts')).toBe(false);+ // Ordinary stderr from a healthy resumed session must not drop its binding:+ // a compiler, linter, or the task's own output routinely pairs "session"+ // with "unknown"/"invalid"/"not found" somewhere on the same line.+ expect(isCliResumeRejectedMessage('src/session-manager.ts(12,3): error TS2339: unknown property')).toBe(false);+ expect(isCliResumeRejectedMessage('invalid JSON in ~/.config/app/session.json')).toBe(false);+ expect(isCliResumeRejectedMessage('Unknown flag --session-timeout')).toBe(false);+ expect(isCliResumeRejectedMessage('404 not found: /api/sessions/list while session was active')).toBe(false);+ expect(isCliResumeRejectedMessage('expired token; refreshing before the next session call')).toBe(false);});});