claw-subagent-service 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -302,7 +302,12 @@ class OpenClawClient {
|
|
|
302
302
|
const text = chunk.toString();
|
|
303
303
|
stderr += text;
|
|
304
304
|
// 实时记录 stderr,方便调试卡死问题
|
|
305
|
-
|
|
305
|
+
// 子进程退出时管道可能已断开,忽略 EPIPE 避免未捕获异常
|
|
306
|
+
try {
|
|
307
|
+
this.log?.info(`[OpenClawClient] CLI stderr: ${text.trim().substring(0, 300)}`);
|
|
308
|
+
} catch {
|
|
309
|
+
// 忽略日志写入失败
|
|
310
|
+
}
|
|
306
311
|
});
|
|
307
312
|
|
|
308
313
|
// 超时兜底(30 分钟)
|
package/service/worker.js
CHANGED
|
@@ -21,7 +21,15 @@ const HOST = process.env.SILENT_SERVICE_HOST || '127.0.0.1';
|
|
|
21
21
|
// 如果 logger 初始化后,也同步写到 logger
|
|
22
22
|
const originalStderr = process.stderr.write.bind(process.stderr);
|
|
23
23
|
process.stderr.write = (chunk, encoding, callback) => {
|
|
24
|
-
|
|
24
|
+
try {
|
|
25
|
+
originalStderr(chunk, encoding, callback);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// EPIPE 常见于子进程(如 openclaw)已退出但仍在写日志,忽略即可
|
|
28
|
+
if (err.code === 'EPIPE') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
25
33
|
};
|
|
26
34
|
|
|
27
35
|
/**
|
|
@@ -566,6 +574,11 @@ process.on('uncaughtException', async (err) => {
|
|
|
566
574
|
log.warn(`[WORKER] 捕获到 EADDRINUSE(端口 ${PORT}),交由 server 错误处理器重试`);
|
|
567
575
|
return;
|
|
568
576
|
}
|
|
577
|
+
// EPIPE 常见于子进程(如 openclaw)已退出但仍在写日志,不触发整个 worker 关闭
|
|
578
|
+
if (err.code === 'EPIPE') {
|
|
579
|
+
log.warn(`[WORKER] 捕获到 EPIPE(子进程管道断开),忽略`);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
569
582
|
log.error(`[WORKER] 未捕获异常: ${err.message}\n${err.stack}`);
|
|
570
583
|
if (!isShuttingDown) {
|
|
571
584
|
await gracefulShutdown('uncaughtException');
|