Skip to content

armgit / Orkas

Public Imported from GitHub
0

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.

fix: trust successful ACP response text

wyt4371219832f6
diff --git a/src/main/features/local_agents/backends/_acp.ts b/src/main/features/local_agents/backends/_acp.ts
index 804d0c50..df92f09d 100644
--- a/src/main/features/local_agents/backends/_acp.ts
+++ b/src/main/features/local_agents/backends/_acp.ts
@@ -16,7 +16,6 @@
import { createLogger } from '../../../logger.js';
import { logErrorSummary } from '../../../util/log-redact.js';
-import { isHermesApiRetryFailureText } from '../errors.js';
import {
type LocalBackend,
type BackendRunOptions,
@@ -266,18 +265,6 @@ export function makeAcpBackend(def: AcpBackendDef): LocalBackend {
if (opts.signal.aborted) return finish('cancelled', { output: resultText });
if (watchdog.fired()) return finish('timeout', { error: `cli ${watchdog.reason()}`, output: resultText, stderrTail: tail.toString() });
if (code === 0 && resultStatus === 'completed') {
- // Hermes can exhaust its upstream API retries, stream the failure
- // sentence as an agent_message_chunk, then still close with
- // stopReason=end_turn and exit 0. The prefix is runtime-authored,
- // not model prose. Treat that exact one-line terminal shape as a
- // failed run and keep the provider detail out of public output.
- if (isHermesApiRetryFailureText(resultText)) {
- return finish('failed', {
- error: 'upstream provider request failed after retries',
- output: '',
- stderrTail: tail.toString(),
- });
- }
// Demote silent failure: server claimed success via
// stopReason=end_turn but never streamed any text AND
// stderr contained an upstream-provider error. Hermes
diff --git a/src/main/features/local_agents/errors.ts b/src/main/features/local_agents/errors.ts
index 873e6975..ae0b72bc 100644
--- a/src/main/features/local_agents/errors.ts
+++ b/src/main/features/local_agents/errors.ts
@@ -9,17 +9,6 @@ const UPGRADE_REQUIRED_PATTERNS = [
/Codex version is (?:too old|unsupported)/i,
];
-/** Hermes 0.9 can stream this runtime-authored sentence as its only agent
- * message before returning a successful ACP end_turn. It is an upstream
- * request failure, not a model answer. Keep the match deliberately narrow so
- * ordinary explanations that merely discuss API errors remain untouched. */
-export function isHermesApiRetryFailureText(text: unknown): boolean {
- const value = typeof text === 'string' ? text.trim() : '';
- return value.length > 0
- && value.length <= 1_000
- && /^API call failed after \d+ retries?:\s*[^\r\n]+$/iu.test(value);
-}
-
export function classifyCliRuntimeFailure(error: unknown): CliRuntimeFailure {
const text = typeof error === 'string'
? error
diff --git a/src/main/features/local_agents/public-output.ts b/src/main/features/local_agents/public-output.ts
index 03ca6465..372f23f8 100644
--- a/src/main/features/local_agents/public-output.ts
+++ b/src/main/features/local_agents/public-output.ts
@@ -8,7 +8,6 @@
*/
import type { LocalCliType } from './registry.js';
-import { isHermesApiRetryFailureText } from './errors.js';
type KstarSectionId = 'K' | 'S' | 'T' | 'A' | 'EXPECTED' | 'R' | 'DELTA' | 'AAR';
@@ -122,7 +121,6 @@ export function sanitizeLocalAgentPublicOutput(args: {
}): string {
const text = String(args.text || '');
if (args.cli !== 'hermes' || !text.trim()) return text;
- if (isHermesApiRetryFailureText(text)) return '';
if (hasExplicitKstarRequest(String(args.userTask || ''))) return text;
const extracted = extractHermesKstarResult(text);
return extracted.matched ? extracted.result : text;
diff --git a/test/main/features/local_agents/acp_backend.test.ts b/test/main/features/local_agents/acp_backend.test.ts
index 827efebd..108cfbe1 100644
--- a/test/main/features/local_agents/acp_backend.test.ts
+++ b/test/main/features/local_agents/acp_backend.test.ts
@@ -206,7 +206,7 @@ describe('local_agents/backends/_acp process lifecycle', () => {
});
});
- it('fails a terminal Hermes API retry message instead of publishing it as a successful answer', async () => {
+ it('does not infer a transport failure from successful ACP response text', async () => {
const fakeAcpServer = String.raw`
let buffer = '';
const send = (message) => process.stdout.write(JSON.stringify(message) + '\n');
@@ -260,9 +260,8 @@ describe('local_agents/backends/_acp process lifecycle', () => {
}));
expect(events.at(-1)).toMatchObject({
type: 'done',
- status: 'failed',
- error: 'upstream provider request failed after retries',
- output: '',
+ status: 'completed',
+ output: 'API call failed after 3 retries: HTTP 404: 404 Not found. Check the docs for available routes.',
});
});
});
diff --git a/test/main/features/local_agents/errors.test.ts b/test/main/features/local_agents/errors.test.ts
index 07035820..b3850935 100644
--- a/test/main/features/local_agents/errors.test.ts
+++ b/test/main/features/local_agents/errors.test.ts
@@ -1,9 +1,6 @@
import { describe, expect, it } from 'vitest';
-import {
- classifyCliRuntimeFailure,
- isHermesApiRetryFailureText,
-} from '../../../../src/main/features/local_agents/errors';
+import { classifyCliRuntimeFailure } from '../../../../src/main/features/local_agents/errors';
describe('local_agents/errors', () => {
it('classifies Codex model/version rejections as upgrade requirements', () => {
@@ -23,17 +20,3 @@ describe('local_agents/errors', () => {
expect(classifyCliRuntimeFailure(null)).toBeNull();
});
});
-
-describe('local_agents/errors Hermes terminal text', () => {
- it('matches only the bounded one-line retry-exhaustion result', () => {
- expect(isHermesApiRetryFailureText(
- 'API call failed after 3 retries: HTTP 404: 404 Not found. Check the docs for available routes.',
- )).toBe(true);
- expect(isHermesApiRetryFailureText(
- 'The API call failed after 3 retries, so I checked another route and recovered.',
- )).toBe(false);
- expect(isHermesApiRetryFailureText(
- 'API call failed after 3 retries: HTTP 404\nRecovery: use the local conversation.',
- )).toBe(false);
- });
-});
diff --git a/test/main/features/local_agents/public-output.test.ts b/test/main/features/local_agents/public-output.test.ts
index 94ed0f33..e680fa26 100644
--- a/test/main/features/local_agents/public-output.test.ts
+++ b/test/main/features/local_agents/public-output.test.ts
@@ -208,14 +208,14 @@ describe('local_agents/public-output', () => {
})).toBe(raw);
});
- it('does not publish a Hermes terminal API retry failure as agent prose', () => {
+ it('does not infer a Hermes runtime failure from successful response text', () => {
const raw = 'API call failed after 3 retries: HTTP 404: 404 Not found. Check the docs for available routes.';
expect(sanitizeLocalAgentPublicOutput({
cli: 'hermes',
text: raw,
- userTask: 'Explain why the local conversation did not continue.',
- })).toBe('');
+ userTask: 'Reply with this diagnostic verbatim.',
+ })).toBe(raw);
expect(sanitizeLocalAgentPublicOutput({
cli: 'codex',
text: raw,