@sleep2agi/commhub-server 0.9.0-preview.195 → 0.9.0-preview.197
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/commhub-server",
|
|
3
|
-
"version": "0.9.0-preview.
|
|
3
|
+
"version": "0.9.0-preview.197",
|
|
4
4
|
"description": "CommHub Server — AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and MCP tools (17 collaboration-core + node/provider ops tools; authoritative list: docs-site/docs/api/mcp-tools.md).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -40,6 +40,14 @@ describe("#2840 节点连续确定性失败告警", () => {
|
|
|
40
40
|
expect(classifyDeterministicFailure("codex-app-server 错误: Missing environment variable: `DEEPSEEK_KEY`")).toBe("missing_env");
|
|
41
41
|
expect(classifyDeterministicFailure("spawn ENOENT")).toBe("binary_missing");
|
|
42
42
|
expect(classifyDeterministicFailure("401 Unauthorized")).toBe("login_required");
|
|
43
|
+
// #2964 —— 这是生产里真实出现的那一句(agent-node 的 codex-health 生成),
|
|
44
|
+
// 原来的正则在它上面返回 null ⇒ 凭据过期的节点一条告警都发不出去。
|
|
45
|
+
expect(classifyDeterministicFailure(
|
|
46
|
+
"codex-app-server 错误: model login expired: this node's CODEX_HOME (/home/user/.anet/nodes/n/codex-home) needs a fresh login — log in again there: CODEX_HOME=/x codex login. Not taking work until then (do not copy another node's auth.json).",
|
|
47
|
+
)).toBe("login_required");
|
|
48
|
+
expect(classifyDeterministicFailure("model login revoked: this node's CODEX_HOME needs a fresh login")).toBe("login_required");
|
|
49
|
+
// 反例:非登录类的失败不能被吸进来
|
|
50
|
+
expect(classifyDeterministicFailure("model login ok")).toBeNull();
|
|
43
51
|
expect(classifyDeterministicFailure("codex request 'turn/start' timed out")).toBeNull();
|
|
44
52
|
// #2891 —— 额度耗尽单列一类;限流(会自愈)**不能**混进来
|
|
45
53
|
expect(classifyDeterministicFailure("opencode 错误: 模型调用失败(provider.quota: The usage limit has been reached)")).toBe("quota_exhausted");
|
|
@@ -27,7 +27,13 @@ const PATTERNS: Array<{ category: Category; re: RegExp; label: string; hint: str
|
|
|
27
27
|
hint: "在节点所在机器补上该变量后重启节点(anet node start <alias>)" },
|
|
28
28
|
{ category: "binary_missing", re: /ENOENT|No such file or directory/i, label: "二进制/文件缺失",
|
|
29
29
|
hint: "检查该节点的运行时是否安装完整,必要时重装后重启节点" },
|
|
30
|
-
|
|
30
|
+
// #2964 —— 真实的登录失效文案长这样(agent-node/src/runtime/codex-health.ts 生成):
|
|
31
|
+
// "model login expired: this node's CODEX_HOME (/…/codex-home) needs a fresh login — log in again there: …"
|
|
32
|
+
// 原来的 /login required|Unauthorized|\b401\b/ **匹配不到这一句**:它写的是
|
|
33
|
+
// "needs a fresh login",不是 "login required"。实测 2026-10-29 一个凭据过期的节点
|
|
34
|
+
// 启动后每轮都以这句话失败,而 #2840 的告警一条都不会发 —— 分类器看不见它。
|
|
35
|
+
// 补两种状态词(expired / revoked)与那句固定结尾,仍然只认登录态,不扩大到泛化的 auth 字样。
|
|
36
|
+
{ category: "login_required", re: /login required|Unauthorized|\b401\b|model login (?:expired|revoked)|needs a fresh login/i, label: "凭据/登录失效",
|
|
31
37
|
hint: "重新登录该节点(anet node codex login-status 可先自检)" },
|
|
32
38
|
// #2891 —— 额度耗尽:与前三类同性质(不会自愈、必须人处理),但**必须与「限流」分开**。
|
|
33
39
|
//
|
|
@@ -31,9 +31,20 @@ describe("#669 parent source marker", () => {
|
|
|
31
31
|
expect(inserts.some((l) => l.includes("metaJsonWithParent"))).toBe(true);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// 这条原本断言「REST 里根本没有 parent_source」——理由是「REST 不走推断,
|
|
35
|
+
// 不要造第二真相」。方向对,但结论错了一半:REST 确实**不该推断**,
|
|
36
|
+
// 可它建的子任务同样是显式父子关系,不标就会被统计漏掉。
|
|
37
|
+
//
|
|
38
|
+
// 实测(2026-10-29,.195 上线后 90 分钟):3 条带 parent 的任务全部走 REST、
|
|
39
|
+
// 全部没有 parent_source。而 MCP 那条路是标的 ⇒ 分母只含 MCP,
|
|
40
|
+
// explicit 占比会被系统性压低。#669 要统计的正是这个比例。
|
|
41
|
+
test("REST /api/task 标「显式」,但不推断", () => {
|
|
35
42
|
const rest = readFileSync(new URL("./server.ts", import.meta.url), "utf8");
|
|
36
43
|
expect(rest).toContain("body.parent_task_id ?? null");
|
|
37
|
-
expect(rest.
|
|
44
|
+
expect(rest).toContain('parent_source: "explicit"');
|
|
45
|
+
// 不能出现第二份推断:REST 里没有「找最近 delivered」这种 SQL。
|
|
46
|
+
const restBlock = rest.slice(rest.indexOf("const metaWithParent"), rest.indexOf("const metaWithParent") + 400);
|
|
47
|
+
expect(restBlock.toLowerCase()).not.toContain("delivered");
|
|
48
|
+
expect(rest).not.toContain('parentSource = "inferred"');
|
|
38
49
|
});
|
|
39
50
|
});
|
package/src/server.ts
CHANGED
|
@@ -4248,7 +4248,15 @@ return Bun.serve({
|
|
|
4248
4248
|
: restAuth
|
|
4249
4249
|
? "user"
|
|
4250
4250
|
: "legacy";
|
|
4251
|
-
|
|
4251
|
+
// #669 —— REST 这一侧只标「显式」,**绝不推断**(推断只存在于 MCP send_task)。
|
|
4252
|
+
// 但不标就会有一个偏差:REST 建的子任务全部落进「无标记」,
|
|
4253
|
+
// 而 MCP 建的显式子任务有标记 ⇒ 统计里 explicit 被系统性地压低。
|
|
4254
|
+
// 实测(2026-10-29):近 90 分钟 3 条带 parent 的任务全部走 REST、全部无标记。
|
|
4255
|
+
// parent_source 已排除出幂等指纹(task-idempotency.ts),加上它不影响重放判定。
|
|
4256
|
+
const metaWithParent = body.parent_task_id
|
|
4257
|
+
? { ...(mergedMeta && typeof mergedMeta === "object" ? mergedMeta : {}), parent_source: "explicit" }
|
|
4258
|
+
: mergedMeta;
|
|
4259
|
+
const metaJson = normalizeMetaJson(stampTaskAuthOrigin(metaWithParent, authOrigin));
|
|
4252
4260
|
|
|
4253
4261
|
// Client-request-id idempotency, mirroring the MCP `send_task` tool
|
|
4254
4262
|
// (tools.ts). The app/Dashboard mint one `meta.client_request_id` per
|