The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a refused gateway ensure names its remedy
Teknium5130bfeea15b
diff --git a/apps/desktop/electron/local-gateway.test.ts b/apps/desktop/electron/local-gateway.test.tsindex a3203235700..a0a7cd1be85 100644--- a/apps/desktop/electron/local-gateway.test.ts+++ b/apps/desktop/electron/local-gateway.test.ts@@ -492,3 +492,12 @@ test('a session write that names its owner only in the body gets a grant for thaexpect(nativeGrantRoute(url, body)).toBe(url)}})++test('an ensure refusal names its remedy instead of only a status pointer', async () => {+ // A gateway another install owns is refused, not replaced; ensure says what to do in `detail`.+ const detail = "another Hermes install's gateway owns this profile; stop it there: hermes gateway stop"++ await expect(ensureLocalGateway(async () => ({+ code: 3, stdout: JSON.stringify({ state: 'incompatible', reason_code: 'runtime_protocol', detail, endpoint: null })+ }))).rejects.toThrow(`Gateway incompatible (runtime_protocol). ${detail}. Use hermes gateway status for recovery.`)+})diff --git a/apps/desktop/electron/local-gateway.ts b/apps/desktop/electron/local-gateway.tsindex da2de69b256..493ac012f84 100644--- a/apps/desktop/electron/local-gateway.ts+++ b/apps/desktop/electron/local-gateway.ts@@ -184,7 +184,11 @@ export async function ensureLocalGateway(}if (result.code !== 0 || payload.state !== 'ready') {- throw new Error(`Gateway ${payload.state || 'inaccessible'} (${payload.reason_code || 'ensure_failed'}). Use hermes gateway status for recovery.`)+ // A refused replacement (another install's or a newer Hermes's gateway) names its remedy in+ // `detail`; a start that died carries its own output there. Either beats a pointer elsewhere.+ const detail = typeof payload.detail === 'string' && payload.detail.trim() ? ` ${payload.detail.trim().split(/\r?\n/)[0]}.` : ''++ throw new Error(`Gateway ${payload.state || 'inaccessible'} (${payload.reason_code || 'ensure_failed'}).${detail} Use hermes gateway status for recovery.`)}const endpoint: GatewayEndpoint = payload.endpoint