From 7c9a6e913ef5561d317a85b3977684d135d7a842 Mon Sep 17 00:00:00 2001 From: stswangzhiping <59632378+stswangzhiping@users.noreply.github.com> Date: Fri, 3 Apr 2026 10:53:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A1=AE=E4=BF=9D=20origin=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=90=8E=E5=86=8D=E9=87=8D=E5=90=AF=20gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit active+full provider 路径: addProviderSync → onDone(写 origin) → restartGateway 一次 之前顺序错误导致 gateway 用旧 origin 重启后再重启一次。 _updateOpenClawOrigin 只负责写盘,不再调 pkill。 移除 client.js 中已无用的 execSync 引入。 Made-with: Cursor --- lib/client.js | 9 +-------- lib/openclaw-provider.js | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/client.js b/lib/client.js index abee816..f965d70 100644 --- a/lib/client.js +++ b/lib/client.js @@ -3,7 +3,7 @@ const fs = require('fs'); const { getNotifySocket } = require('./systemd-env'); const WebSocket = require('ws'); -const { execSync, execFileSync } = require('child_process'); +const { execFileSync } = require('child_process'); const config = require('./config'); const log = require('./logger'); const { getBoxId } = require('./fingerprint'); @@ -550,13 +550,6 @@ class ClawClient { writeFileSync(configFile, `${JSON.stringify(config, null, 2)}\n`, 'utf8'); log.info('clawd', `openclaw config 已更新: ${newOrigin}`); - - try { - execSync('pkill -9 -x openclaw-gateway', { timeout: 3000 }); - log.info('clawd', 'openclaw-gateway 已终止,等待自动重启'); - } catch (_) { - log.info('clawd', 'openclaw-gateway 进程不存在,无需终止'); - } } catch (e) { log.warn('clawd', `openclaw config 更新失败: ${e.message}`); } diff --git a/lib/openclaw-provider.js b/lib/openclaw-provider.js index ed2a0f0..fe53669 100644 --- a/lib/openclaw-provider.js +++ b/lib/openclaw-provider.js @@ -282,7 +282,6 @@ function applyFullProviderFromVps(provider, onDone) { log.warn('openclaw-provider', `拉模型失败,使用空列表: ${err.message}`); } addProviderSync(configFile, name, baseUrl, apiKey, list, defaultModel); - restartGateway(); if (typeof onDone === 'function') { try { onDone(); @@ -290,6 +289,7 @@ function applyFullProviderFromVps(provider, onDone) { log.warn('openclaw-provider', `onDone: ${e.message}`); } } + restartGateway(); } catch (e) { log.error('openclaw-provider', `apply 写配置失败: ${e.message}`); } finally {