@tea-agent/loop-agent 0.34.1 → 0.34.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.34.2] - 2026-08-12
|
|
6
|
+
|
|
7
|
+
### 重点更新
|
|
8
|
+
|
|
9
|
+
- 修复控制台 DAG 执行在 120 秒后被强制终止导致状态卡死的问题,默认超时现提升至 4 小时
|
|
10
|
+
|
|
11
|
+
### 改进
|
|
12
|
+
|
|
13
|
+
- DAG 挂钟时间常量统一收敛至 src/shared 共享模块管理,移除了 workflows 中不必要的内核导入
|
|
14
|
+
|
|
15
|
+
### 修复
|
|
16
|
+
|
|
17
|
+
- 修复控制台任务导航执行 DAG 时因 LoopAgentClient 默认 120 秒超时被强制终止的问题,现已将默认超时提升至 4 小时,并支持通过 --default-timeout-ms 参数覆盖
|
|
18
|
+
- 修正自定义模型合并报告中的文档描述错误
|
|
19
|
+
|
|
5
20
|
## [0.34.1] - 2026-08-11
|
|
6
21
|
|
|
7
22
|
### 重点更新
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_TIMEOUT_MS, MAX_ALLOWED_TIMEOUT_MS } from "../executors/pi-executor.js";
|
|
2
2
|
export { MAX_ALLOWED_TIMEOUT_MS };
|
|
3
|
+
/**
|
|
4
|
+
* DAG runner 绝对最大墙钟(4h)。不可被空心跳续期;
|
|
5
|
+
* 是 DEFAULT_LIVENESS_POLICY 与 Console LoopAgentClient 默认超时的单一真源。
|
|
6
|
+
*/
|
|
7
|
+
export const DAG_ABSOLUTE_MAX_WALL_CLOCK_MS = 14_400_000;
|
|
3
8
|
/**
|
|
4
9
|
* Clamp timeout values for Pi steps. Undefined or non-positive values fall back to
|
|
5
10
|
* DEFAULT_TIMEOUT_MS so task-level invalid values do not disable Pi execution timeouts.
|
package/dist/worker/cli.js
CHANGED
|
@@ -720,6 +720,7 @@ export function buildAgentWorkerProgram() {
|
|
|
720
720
|
.option("--host <host>", "Bind host (default 127.0.0.1; use 0.0.0.0 for LAN, no network auth)", "127.0.0.1")
|
|
721
721
|
.option("--debug", "Log request source/method/path/status to stderr")
|
|
722
722
|
.option("--app-data <path>", "Override Console application-data root (Draft/Operation/confirmation)")
|
|
723
|
+
.option("--default-timeout-ms <ms>", "LoopAgentClient hard timeout for Console operations (ms; default 14400000 / 4h; 0 disables)")
|
|
723
724
|
.action(async (options) => {
|
|
724
725
|
await runConsoleServe({
|
|
725
726
|
repoRoot: path.resolve(options.repo),
|
|
@@ -729,6 +730,7 @@ export function buildAgentWorkerProgram() {
|
|
|
729
730
|
appDataRoot: options.appData
|
|
730
731
|
? path.resolve(options.appData)
|
|
731
732
|
: undefined,
|
|
733
|
+
defaultTimeoutMsRaw: options.defaultTimeoutMs,
|
|
732
734
|
});
|
|
733
735
|
});
|
|
734
736
|
consoleCmd
|
|
@@ -738,6 +740,7 @@ export function buildAgentWorkerProgram() {
|
|
|
738
740
|
.option("--host <host>", "Bind host (default 127.0.0.1; use 0.0.0.0 for LAN, no network auth)", "127.0.0.1")
|
|
739
741
|
.option("--debug", "Log request source/method/path/status to stderr")
|
|
740
742
|
.option("--app-data <path>", "Override Console application-data root (Draft/Operation/confirmation)")
|
|
743
|
+
.option("--default-timeout-ms <ms>", "LoopAgentClient hard timeout for Console operations (ms; default 14400000 / 4h; 0 disables)")
|
|
741
744
|
.description("Start Loop Operator Console HTTP server (compat entry; equivalent to bare `agent-worker console`)")
|
|
742
745
|
.action(async (options) => {
|
|
743
746
|
await runConsoleServe({
|
|
@@ -748,6 +751,7 @@ export function buildAgentWorkerProgram() {
|
|
|
748
751
|
appDataRoot: options.appData
|
|
749
752
|
? path.resolve(options.appData)
|
|
750
753
|
: undefined,
|
|
754
|
+
defaultTimeoutMsRaw: options.defaultTimeoutMs,
|
|
751
755
|
});
|
|
752
756
|
});
|
|
753
757
|
consoleCmd
|
|
@@ -835,6 +839,17 @@ export async function main(argv = process.argv) {
|
|
|
835
839
|
async function readTaskYaml(taskSpecPath) {
|
|
836
840
|
return YAML.parse(await readFile(taskSpecPath, "utf-8"));
|
|
837
841
|
}
|
|
842
|
+
/** Parse optional `--default-timeout-ms`; undefined keeps Console default. */
|
|
843
|
+
function parseOptionalTimeoutMs(raw) {
|
|
844
|
+
if (raw === undefined || raw.trim() === "") {
|
|
845
|
+
return undefined;
|
|
846
|
+
}
|
|
847
|
+
const value = Number(raw);
|
|
848
|
+
if (!Number.isFinite(value) || value < 0 || !Number.isInteger(value)) {
|
|
849
|
+
throw new Error(`--default-timeout-ms must be a non-negative integer (ms); got ${JSON.stringify(raw)}`);
|
|
850
|
+
}
|
|
851
|
+
return value;
|
|
852
|
+
}
|
|
838
853
|
/** Shared console serve entry used by both bare `console` and `console serve`. */
|
|
839
854
|
async function runConsoleServe(options) {
|
|
840
855
|
const { createConsoleServer } = await import("./console/server.js");
|
|
@@ -845,6 +860,7 @@ async function runConsoleServe(options) {
|
|
|
845
860
|
port: options.port,
|
|
846
861
|
debug: options.debug === true,
|
|
847
862
|
appDataRoot: options.appDataRoot,
|
|
863
|
+
defaultTimeoutMs: parseOptionalTimeoutMs(options.defaultTimeoutMsRaw),
|
|
848
864
|
});
|
|
849
865
|
process.stdout.write(`${server.url}\n`);
|
|
850
866
|
await new Promise((resolve) => {
|
|
@@ -4,6 +4,7 @@ import { createServer } from "node:http";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { LoopAgentClient } from "../loop-agent/loop-agent-client.js";
|
|
7
|
+
import { DAG_ABSOLUTE_MAX_WALL_CLOCK_MS } from "../../shared/timeout-policy.js";
|
|
7
8
|
import { openConsoleAppData } from "./app-data.js";
|
|
8
9
|
import { DagConfirmationStore } from "./dag-confirmation.js";
|
|
9
10
|
import { DagExecutionReceiptStore } from "./dag-execution-receipt.js";
|
|
@@ -24,6 +25,30 @@ import { resolveSiblingLoopAgentBin } from "./sibling-controller.js";
|
|
|
24
25
|
import { NightAuxTicker } from "./night-aux-ticker.js";
|
|
25
26
|
import { deriveObserveRouteCapabilities } from "../observe/health.js";
|
|
26
27
|
import { createObserveRouteContext, defaultObserveStaticDir, handleMatchedObserveRoute, matchObserveGetRoute, ROUTES, serveObserveStatic, } from "../observe/routes.js";
|
|
28
|
+
/**
|
|
29
|
+
* Default hard timeout for the Console-owned LoopAgentClient.
|
|
30
|
+
*
|
|
31
|
+
* Console task-nav operations (`dag execute`, `task advance --approve-gate`,
|
|
32
|
+
* etc.) spawn a long-lived sibling runner via the operation runner. The
|
|
33
|
+
* worker client hard-kills children after `defaultTimeoutMs` (default 120s),
|
|
34
|
+
* which is far below multi-node DAG wall clocks and leaves `state.json`
|
|
35
|
+
* stuck in `running` with no error. Align with shared `DAG_ABSOLUTE_MAX_WALL_CLOCK_MS`
|
|
36
|
+
* (4h) so the client is a safety net, not a false deadline.
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_CONSOLE_CLIENT_TIMEOUT_MS = DAG_ABSOLUTE_MAX_WALL_CLOCK_MS;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the Console LoopAgentClient default timeout.
|
|
41
|
+
* `0` disables the client hard timeout (DAG kernel owns wall clock).
|
|
42
|
+
*/
|
|
43
|
+
export function resolveConsoleDefaultTimeoutMs(override) {
|
|
44
|
+
if (override === undefined) {
|
|
45
|
+
return DEFAULT_CONSOLE_CLIENT_TIMEOUT_MS;
|
|
46
|
+
}
|
|
47
|
+
if (!Number.isFinite(override) || override < 0) {
|
|
48
|
+
throw new Error(`console serve: invalid defaultTimeoutMs ${String(override)} (expected >= 0)`);
|
|
49
|
+
}
|
|
50
|
+
return override;
|
|
51
|
+
}
|
|
27
52
|
/** Built static assets live next to the compiled server under dist/worker/console/static. */
|
|
28
53
|
export function defaultConsoleStaticDir(fromFileUrl = import.meta.url) {
|
|
29
54
|
return path.join(path.dirname(fileURLToPath(fromFileUrl)), "static");
|
|
@@ -74,6 +99,9 @@ export async function createConsoleServer(options) {
|
|
|
74
99
|
loopAgentBin: resolveSiblingLoopAgentBin(),
|
|
75
100
|
artifactRoot,
|
|
76
101
|
resolveIdentity: true,
|
|
102
|
+
// See DEFAULT_CONSOLE_CLIENT_TIMEOUT_MS: dag execute / task advance
|
|
103
|
+
// must not inherit the 120s worker-command default.
|
|
104
|
+
defaultTimeoutMs: resolveConsoleDefaultTimeoutMs(options.defaultTimeoutMs),
|
|
77
105
|
});
|
|
78
106
|
if (!options.skipReconcile) {
|
|
79
107
|
await operations.reconcileOnBoot();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { DAG_ABSOLUTE_MAX_WALL_CLOCK_MS } from "../../shared/timeout-policy.js";
|
|
2
3
|
/**
|
|
3
4
|
* Adaptive liveness policy for DAG/Pi supervision.
|
|
4
5
|
*
|
|
@@ -15,7 +16,7 @@ export const DEFAULT_LIVENESS_POLICY = {
|
|
|
15
16
|
stallProbeMs: 900_000,
|
|
16
17
|
abortGraceMs: 30_000,
|
|
17
18
|
/** 4h absolute max wall clock — cannot be renewed by empty heartbeats. */
|
|
18
|
-
absoluteMaxWallClockMs:
|
|
19
|
+
absoluteMaxWallClockMs: DAG_ABSOLUTE_MAX_WALL_CLOCK_MS,
|
|
19
20
|
};
|
|
20
21
|
export const dagLivenessPolicySchema = z
|
|
21
22
|
.object({
|