From acc5a8e2d8cbb88331d6e71337ac2aba17606efd Mon Sep 17 00:00:00 2001 From: mesalogo Date: Sun, 30 Aug 2026 14:42:18 +0800 Subject: [PATCH] fix: allow slower OpenCode server startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bundled OpenCode server could be reported unavailable when slower Linux ARM systems needed more than ten seconds to initialize. GoodBuddy now allows thirty seconds for startup before terminating the server and reports the updated timeout. Release note: 修复部分 Linux ARM 设备上 OpenCode 冷启动较慢时被误报为启动超时的问题。 --- src/main/agent/opencode-runtime.test.ts | 2 +- src/main/agent/opencode-runtime.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/agent/opencode-runtime.test.ts b/src/main/agent/opencode-runtime.test.ts index 76f4ab2d..d3b8d953 100644 --- a/src/main/agent/opencode-runtime.test.ts +++ b/src/main/agent/opencode-runtime.test.ts @@ -997,7 +997,7 @@ describe('OpenCodeRuntime embedded launcher', () => { expect(status).toMatchObject({ available: false, - detail: 'OpenCode Server 启动超时(10 秒)' + detail: 'OpenCode Server 启动超时(30 秒)' }) expect(status.detail).not.toContain(secret) expect(child.kill).toHaveBeenCalledWith('SIGTERM') diff --git a/src/main/agent/opencode-runtime.ts b/src/main/agent/opencode-runtime.ts index 9134a921..55b1bbf5 100644 --- a/src/main/agent/opencode-runtime.ts +++ b/src/main/agent/opencode-runtime.ts @@ -62,7 +62,7 @@ import { } from './child-process-termination' const MAX_STARTUP_OUTPUT_BYTES = 64 * 1024 -const STARTUP_TIMEOUT_MS = 10_000 +const STARTUP_TIMEOUT_MS = 30_000 const MAX_PERMISSION_NAME_LENGTH = 128 const MAX_PERMISSION_PATTERNS = 32 const MAX_PERMISSION_PATTERN_LENGTH = 1_024 @@ -1079,7 +1079,7 @@ export class OpenCodeRuntime implements AgentRuntime { fail('OpenCode Server 启动已取消') } const timeout = setTimeout(() => { - fail('OpenCode Server 启动超时(10 秒)') + fail('OpenCode Server 启动超时(30 秒)') }, this.dependencies.startupTimeoutMs) if (!stdout || !stderr) {