fix(channel): Feishu channel gateway wont restart after config (#291)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Haze
2026-03-04 21:45:44 +08:00
committed by GitHub
Unverified
parent 5ddb7d281d
commit be800f6cfc
5 changed files with 186 additions and 9 deletions

View File

@@ -138,7 +138,7 @@ export function registerIpcHandlers(
registerClawHubHandlers(clawHubService);
// OpenClaw handlers
registerOpenClawHandlers(gatewayManager);
registerOpenClawHandlers();
// Provider handlers
registerProviderHandlers(gatewayManager);
@@ -695,7 +695,7 @@ function registerGatewayHandlers(
* OpenClaw-related IPC handlers
* For checking package status and channel configuration
*/
function registerOpenClawHandlers(gatewayManager: GatewayManager): void {
function registerOpenClawHandlers(): void {
async function ensureDingTalkPluginInstalled(): Promise<{ installed: boolean; warning?: string }> {
const targetDir = join(homedir(), '.openclaw', 'extensions', 'dingtalk');
const targetManifest = join(targetDir, 'openclaw.plugin.json');
@@ -808,7 +808,9 @@ function registerOpenClawHandlers(gatewayManager: GatewayManager): void {
};
}
await saveChannelConfig(channelType, config);
gatewayManager.debouncedRestart();
logger.info(
`Skipping app-forced Gateway restart after channel:saveConfig (${channelType}); Gateway handles channel config reload/restart internally`
);
return {
success: true,
pluginInstalled: installResult.installed,
@@ -816,8 +818,12 @@ function registerOpenClawHandlers(gatewayManager: GatewayManager): void {
};
}
await saveChannelConfig(channelType, config);
// Debounced restart so the gateway picks up the new channel config.
gatewayManager.debouncedRestart();
// Do not force stop/start here. Recent Gateway builds detect channel config
// changes and perform an internal service restart; forcing another restart
// from Electron can race with reconnect and kill the newly spawned process.
logger.info(
`Skipping app-forced Gateway restart after channel:saveConfig (${channelType}); waiting for Gateway internal channel reload`
);
return { success: true };
} catch (error) {
console.error('Failed to save channel config:', error);