@suifei/dsh-ai-team 0.4.68 → 0.4.70
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 +38 -0
- package/index.js +14 -2
- package/lib/runtime/wake-failure.js +22 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.70 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**唤醒失败归类抽成单一实现 + 归档项目不再刷 attach 告警**
|
|
6
|
+
|
|
7
|
+
0.4.69 把「写租约被占用」写成一条独立的 `wake.session-busy`,但重建结果本来就有
|
|
8
|
+
`member.autoreseat` 记录,所以那条行只用于 `full` 级诊断——设计如此,也意味着它
|
|
9
|
+
不该内联在 `index.js` 里用正则判断。
|
|
10
|
+
|
|
11
|
+
- 抽出 `lib/runtime/wake-failure.js` 的 `classifyWakeFailure(causeChain)`:单一实现、
|
|
12
|
+
可单测;只认 `active write handle`,其它原因(无 continuation state / 无 preset
|
|
13
|
+
投影 / 无 cause)一律仍归 `wake.fail`。
|
|
14
|
+
- 归档项目的成员不再尝试 `workspace.attachSession`:`prj_main`(已归档)的 2 个历史
|
|
15
|
+
会话 cwd 指向旧插件数据目录,每次 boot 必然产生一对 `workspace.attach.fail`,
|
|
16
|
+
而归档项目不会有成员干活——这类项目交给「更换目录 + 重建会话」处理。
|
|
17
|
+
- 测试:`node --test` **272 通过 / 1 跳过**(新增 `wake-failure` 2 例:busy 归类、
|
|
18
|
+
其它原因不误判,含「write handle timeout」这类相似文本的反例)。
|
|
19
|
+
|
|
20
|
+
## 0.4.69 - 2026-11-12
|
|
21
|
+
|
|
22
|
+
**`NOT_RESUMABLE` 根因确诊:成员会话的写句柄从未释放**
|
|
23
|
+
|
|
24
|
+
用 0.4.66 的 cause 字段抓到了真话:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{"ev":"wake.fail","code":"NOT_RESUMABLE",
|
|
28
|
+
"message":"subagent \"330442f7-…\" is unavailable",
|
|
29
|
+
"cause":"session \"330442f7-…\" is already owned by an active write handle"}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
链路:成员回合结束 → `sessions.get(childId)` 取不到会话 → 走冷恢复 → persistence 发现该会话**仍被一个活跃写句柄占用**,拒绝发放读租约 → 外层折叠成 `subagent "X" is unavailable` → 插件重建。
|
|
33
|
+
|
|
34
|
+
这是 Harness 侧的**句柄泄漏**(会话已从 sessions 服务移除,但 persistence 的写租约没释放),插件无法直接修;但我们能停止把它当成未知故障:
|
|
35
|
+
|
|
36
|
+
- 该原因归类为 `wake.session-busy`(不带 `.fail`,发布默认级别不再刷屏),重建路径与上下文注入不变;
|
|
37
|
+
- 其它原因仍记 `wake.fail`,并保留 `code` / `cause`;
|
|
38
|
+
- 诊断探针结论:`persistence.stat` 本身正常(无 `persistence.stat.fail`、无 `service.missing.fail`),进一步确认问题在**写租约占用**而非读取能力。
|
|
39
|
+
- 测试:`node --test` **270 通过 / 1 跳过**(新增 1 例:句柄占用被识别、其它原因不被误判)。
|
|
40
|
+
|
|
3
41
|
## 0.4.68 - 2026-11-12
|
|
4
42
|
|
|
5
43
|
**决定性探针:boot 后真实 `persistence.stat()` 一次,暴露原始错误码**
|
package/index.js
CHANGED
|
@@ -48,6 +48,7 @@ import { buildModelCatalog } from './lib/host/model-catalog.js';
|
|
|
48
48
|
import { createTeamTool } from './lib/host/member-tools.js';
|
|
49
49
|
import { describeTaskContext, describeWake, planWakes } from './lib/host/waker.js';
|
|
50
50
|
import { describeCauseChain } from './lib/runtime/error-chain.js';
|
|
51
|
+
import { classifyWakeFailure } from './lib/runtime/wake-failure.js';
|
|
51
52
|
import { aggregatePeople } from './lib/host/people-view.js';
|
|
52
53
|
import { riskView } from './lib/host/risk-view.js';
|
|
53
54
|
import { weeklyView } from './lib/host/weekly-view.js';
|
|
@@ -374,6 +375,11 @@ export function apply(ctx, config = {}) {
|
|
|
374
375
|
};
|
|
375
376
|
const attachMemberWorkspace = async (projectRuntime, sessionId) => {
|
|
376
377
|
if (typeof sessionId !== 'string' || sessionId === '') return;
|
|
378
|
+
// 归档项目(只读视图)的成员不会再干活:给它们 attach 只会每轮 boot 产生
|
|
379
|
+
// 一对注定失败的 `workspace.attach.fail`(会话 cwd 是历史的插件数据目录)。
|
|
380
|
+
// 这类项目交给「更换目录 + 重建会话」处理,不在这里制造噪音。
|
|
381
|
+
const projectState = projectRuntime?.service?.state?.projects?.[projectRuntime?.id ?? ''];
|
|
382
|
+
if (projectState?.status === 'archived') return;
|
|
377
383
|
const workspace = await workspaceForProject(projectRuntime);
|
|
378
384
|
if (workspace === null || workspace === undefined || typeof workspace.attachSession !== 'function') return;
|
|
379
385
|
try {
|
|
@@ -781,8 +787,14 @@ export function apply(ctx, config = {}) {
|
|
|
781
787
|
});
|
|
782
788
|
} catch (error) {
|
|
783
789
|
wakeKeys.delete(plan.key);
|
|
790
|
+
const causeChain = describeCauseChain(error);
|
|
791
|
+
// 实机根因:成员会话的**写句柄没有释放**——`sessions.get()` 已取不到它,
|
|
792
|
+
// 但 persistence 仍判定它「already owned by an active write handle」,
|
|
793
|
+
// 于是冷恢复必然失败。这是 Harness 侧的句柄泄漏,插件只能重建。
|
|
794
|
+
// 归类成单独事件:不再让这类必然失败每天刷上百条 `wake.fail`,
|
|
795
|
+
// 但仍在 `full` 级别可见,且重建路径不变。
|
|
784
796
|
diag.append({
|
|
785
|
-
ev:
|
|
797
|
+
ev: classifyWakeFailure(causeChain),
|
|
786
798
|
projectId: projectRuntime.id,
|
|
787
799
|
memberId: plan.memberId,
|
|
788
800
|
taskId: plan.taskId ?? null,
|
|
@@ -792,7 +804,7 @@ export function apply(ctx, config = {}) {
|
|
|
792
804
|
// 外层错误只写「subagent X is unavailable」,真实原因在 cause 里
|
|
793
805
|
// (persistence 读不出会话 / descriptor 不可续 / 血缘校验失败)。
|
|
794
806
|
// 不把它带出来,每次只能看到同一句无从下手的提示。
|
|
795
|
-
cause:
|
|
807
|
+
cause: causeChain,
|
|
796
808
|
});
|
|
797
809
|
console.warn('[ai-team] wake failed:', plan.memberId, error?.code ?? error?.message ?? error);
|
|
798
810
|
// 一次性迁移自愈:旧形态成员会话(历史上由 agents.create 创建、
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 唤醒失败的归类。
|
|
3
|
+
*
|
|
4
|
+
* 实机根因(2026-11-12 确诊):成员回合结束后会话仍被一个活跃写句柄占用,
|
|
5
|
+
* `sessionQuery.observeSession` 拒绝发放读租约,冷恢复必然失败:
|
|
6
|
+
*
|
|
7
|
+
* subagent "X" is unavailable
|
|
8
|
+
* cause: session "X" is already owned by an active write handle
|
|
9
|
+
*
|
|
10
|
+
* 插件无法释放这个租约(属 Harness 侧的句柄泄漏),只能重建会话。这类失败是
|
|
11
|
+
* **可预期的**,不应按未知故障刷告警;其它原因仍然算真实失败。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const BUSY_HANDLE = /active write handle/i;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string|null|undefined} causeChain `describeCauseChain()` 的输出
|
|
18
|
+
* @returns {'wake.session-busy'|'wake.fail'} busy 表示「写租约被占用,必然需要重建」
|
|
19
|
+
*/
|
|
20
|
+
export function classifyWakeFailure(causeChain) {
|
|
21
|
+
return typeof causeChain === 'string' && BUSY_HANDLE.test(causeChain) ? 'wake.session-busy' : 'wake.fail';
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.70",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
|
|
6
6
|
"license": "MIT",
|