dsh-workplan 2.1.0 → 2.1.1

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
@@ -1,3 +1,39 @@
1
+ ## 2.1.1 — 2026-11-06
2
+
3
+ **修复 2.1.0 的三处「说到了但没做到」:格式退回通知在续跑时送不到部门人员、中文 README 的安装命令仍指旧版本、安全文档里有一句「当前 1.12.0」的错误陈述。**
4
+
5
+ ### 一、退回通知为什么没送到(根因)
6
+
7
+ 用户要求是「结果不符合格式立刻退回,通知其重新检查格式」。2.1.0 把退回原因写进了状态行(`blockedKind:'comm-format'` + `error`),但续跑路径的顺序错了:
8
+
9
+ 1. 计划被判 `blocked` 后再次派发,`dispatchPlan` 先调用 `resetBlockedStatuses`,把受阻行连同 `blockedKind` / `error` 一起清成待跑;
10
+ 2. `executeSubtask` 随后才去读「这一行上次是不是格式退回」,此时信息已经被清掉;
11
+ 3. 结果:退回只留下一个状态记号,子 Agent 重跑时看到的提示词与第一次完全一样(实测两次提示词长度都是 4374 字符),只能把同样的格式错误再交一遍。
12
+
13
+ 修复(`src/runtime.ts`):
14
+
15
+ - `dispatchPlan` 在 `resetBlockedStatuses` **之前**扫出 `blockedKind === 'comm-format'` 的行,把退回原因抄进 `record.commFormatRejections`;
16
+ - `executeSubtask` 在行内 `blockedKind` 已被清掉时改读这份记录,作为 `COMM_FORMAT_REJECTED` 的上次失败原因带给子提示词;
17
+ - 消费一次即删,同一条退回通知不会被后续无关重试重复带上。
18
+
19
+ 修复后实测:第 2 次激活的提示词多出「上一次尝试失败」段,包含失败类型 `COMM_FORMAT_REJECTED` 与逐条不合规项(4374 → 4584 字符)。
20
+
21
+ ### 二、另外两处修正
22
+
23
+ - `README.zh.md:72` 的安装命令仍是 `dsh-workplan@1.12.3`,而同文件徽章已是新版本——用户会照着装错版本。已改为 `dsh-workplan@2.1.1`。(`tests/version-sync.test.ts` 只校验 `README.md` 与 `README.en.md`,所以这个缺口一直没被测出来。)
24
+ - `docs/cc/AGD-OPS-SECURE-OPERATION.md` 的安装校验步骤写着「当前 1.12.0」,是唯一一处面向用户的过期「当前版本」陈述。已改为版本中立表述,并在文首补一条带日期的版本说明:正文其余 1.12.0 都是那次评估的历史快照,不改写历史。
25
+
26
+ ### 三、新增验证
27
+
28
+ - 新增 `tests/workplan-comm-format-e2e.test.ts`(2 条):用真实运行时 + 假子会话跑完整链路——不合规结果判 `blocked/comm-format` 且不计完成;修正后同一子任务可判 `done`;**并断言第 2 次激活的提示词确实带「上一次尝试失败」段、失败类型与逐条不合规项**(把「通知」环节钉成回归用例)。
29
+ - `npm run check`(tsc --noEmit)退出码 0。
30
+ - `npm test`:580 条用例,pass 580 / fail 0。
31
+
32
+ ### 四、边界
33
+
34
+ - 修复只影响「因格式不合规被退回」的行;超时、no-ack、escalated 等其它受阻原因的通知路径不变。
35
+ - `commFormatRejections` 是单轮内的传递载体,不写进会话事件;跨轮重跑依赖状态行上的 `blockedKind/error`,二者仍在结果消息里原样保留。
36
+
1
37
  ## 2.1.0 — 2026-11-06
2
38
 
3
39
  **建立主 Agent 与部门人员之间的统一沟通交流格式契约(下发—自检—核验—退回闭环),并保留 2.0.5 草案的规划器 JSON 结构修复。**
package/README.en.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **Two selling points, one line: a full ISO/IEC 15408:2026 evidence pack you can verify with 5 commands, and a one-command install with zero runtime dependencies.**
4
4
 
5
5
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-2.1.0-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
6
+ [![version](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.1)
7
7
 
8
8
  Adds "plan first → dispatch real department subagents → watch progress in the sidebar" to **DeepSeek Harness (DSH)**. No app, no DSH source patch, no page replacement.
9
9
 
@@ -80,7 +80,7 @@ The full contract — roles, data shapes, state machine, recovery, and the three
80
80
  ## Install
81
81
 
82
82
  ```bash
83
- dsh plugin --profile web add dsh-workplan@2.1.0
83
+ dsh plugin --profile web add dsh-workplan@2.1.1
84
84
  ```
85
85
 
86
86
  Restart the DSH Web process (or reload the page) so the bundle is picked up.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **两个卖点,一句话:ISO/IEC 15408:2026 全套安全证据,5 条命令自己验;安装一条命令、零第三方运行时依赖。**
4
4
 
5
5
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-2.1.0-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
6
+ [![version](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.1)
7
7
 
8
8
  给 **DeepSeek Harness(DSH)** 加一段「先拆计划 → 真派部门子 Agent 去做 → 左侧栏实时看进度」的能力。不装 App、不改 DSH 源码、不换页面。
9
9
 
@@ -69,7 +69,7 @@ grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中
69
69
  ## 一键安装
70
70
 
71
71
  ```bash
72
- dsh plugin --profile web add dsh-workplan@2.1.0
72
+ dsh plugin --profile web add dsh-workplan@2.1.1
73
73
  ```
74
74
 
75
75
  装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
package/README.zh.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **两个卖点,一句话:ISO/IEC 15408:2026 全套安全证据,5 条命令自己验;安装一条命令、零第三方运行时依赖。**
4
4
 
5
5
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-2.1.0-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
6
+ [![version](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.1)
7
7
 
8
8
  给 **DeepSeek Harness(DSH)** 加一段「先拆计划 → 真派部门子 Agent 去做 → 左侧栏实时看进度」的能力。不装 App、不改 DSH 源码、不换页面。
9
9
 
@@ -69,7 +69,7 @@ grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中
69
69
  ## 一键安装
70
70
 
71
71
  ```bash
72
- dsh plugin --profile web add dsh-workplan@1.12.3
72
+ dsh plugin --profile web add dsh-workplan@2.1.1
73
73
  ```
74
74
 
75
75
  装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
@@ -1,6 +1,8 @@
1
1
  # 安全操作与准备程序(AGD_OPS.1 / AGD_PRE.1 对齐)/ Secure Operation & Preparation
2
2
 
3
3
  > 对象:dsh-workplan v1.12.0 | 日期:2026-11-03 | 撰写:T5 | 性质:公开自评估文档,不宣称 CC 认证。
4
+ >
5
+ > **版本说明(2026-11-06 补记)**:本文是 v1.12.0 时点的评估快照,正文里的版本号与实测数字都属于那次评估,不改写历史;当前发布版本、下载校验值与变更记录以 README 徽章、CHANGELOG 和 GitHub Release 页为准。
4
6
 
5
7
  ## 0. 覆盖的差距编号
6
8
 
@@ -13,7 +15,7 @@ G-11(安全相关操作不成文)、G-12(安装缺完整性校验步骤)
13
15
  ```bash
14
16
  # 1) 确认包来源是官方 npm 注册表与最新版本号
15
17
  npm view dsh-workplan version dist.tarball
16
- # 期望:版本为 README 宣称的最新版(当前 1.12.0),tarball 域名为 registry.npmjs.org
18
+ # 期望:输出与 README 徽章一致的最新版本号,tarball 域名为 registry.npmjs.org
17
19
 
18
20
  # 2) 下载后校验完整性(sha512 由 npm 提供;发布包 sha256 见 GitHub Release 页附件)
19
21
  npm pack dsh-workplan --pack-destination /tmp && shasum -a 256 /tmp/dsh-workplan-*.tgz
@@ -0,0 +1,95 @@
1
+ # Release record — dsh-workplan 2.1.0 (2026-11-06)
2
+
3
+ ## 1. 变更主题
4
+
5
+ 建立主 Agent 与部门人员之间的**统一沟通交流格式契约**:派发任务时随任务附带同一份格式要求;部门人员提交前据此自查,完全符合后全盘提交;主 Agent 收到后用同一份格式逐条核验,不合规立刻退回并写明不合规条目,通知其重新检查格式后重交。同时保留 2.0.5 草案的规划器 JSON 结构修复。
6
+
7
+ 用户原话要点(2026-11-06):
8
+
9
+ 1. 与相关部门人员之间建立完善、健全的交流沟通机制。
10
+ 2. 派发工作的同时附带一份统一的沟通交流格式要求;部门人员依据该格式自查,完全符合后再全盘交付;主 Agent 收到的结果不符合要求时,立刻退回,通知其重新检查格式。
11
+ 3. 全部完美完成后,按以前规矩同步自动对外发布新源代码和新版本。
12
+
13
+ ## 2. 机制落地位置
14
+
15
+ | 环节 | 代码位置 | 行为 |
16
+ |---|---|---|
17
+ | 下发 | `src/comm-format.ts#renderCommFormatSpec` → `src/plan.ts#buildChildPrompt` 末尾 | 每个子任务提示都附带 F1–F9 九条规范与「提交前自查(强制)」指令 |
18
+ | 自检 | 同上(提示词内强制指令) | 部门人员提交前逐条对照 F1–F9 |
19
+ | 核验 | `src/comm-format.ts#checkCommFormatCompliance` → `src/plan.ts#adjudicateResult` | 主 Agent 用同一份规范逐条核验 F1–F8(F9 为诚信约束) |
20
+ | 退回 | `adjudicateResult` 返回 `blockedKind: 'comm-format'` + `renderCommFormatRejection` | 不合规即判受阻,退回通知写明逐条不合规项与修正要求 |
21
+ | 重交 | `src/runtime.ts#executeSubtask` 的 `lastFailure` 注入(`COMM_FORMAT_REJECTED`) | 退回原因随下次激活回到子提示词,子 Agent 只补缺口不重做 |
22
+
23
+ 九条规范:F1 证据块标记成对、F2 status 合法、F3 三阶段齐全、F4 pass 必须带证据、F5 验收条数不少于计划、F6 产物条目合法(kind ∈ file/url/note 且 ref 非空)、F7 复盘四项、F8 blocked 必须带 question、F9 不得编造。
24
+
25
+ `src/plan.ts` 中 `BLOCKED_KINDS` 同步加入 `'comm-format'`(第 145 行)。
26
+
27
+ ## 3. 设计边界(不夸大)
28
+
29
+ - 只拦 `done` 路径:解析失败、验收缺口、三阶段缺失已被更早的门禁拦下,保留原有更具针对性的诊断。
30
+ - `requirePhases:false`(历史回放 / 明确关闭新契约)不追溯否决旧日志里按当时规则合法的 done。
31
+ - F6 只校验产物声明的合法性,是否必须交付文件由各子任务验收标准决定,避免把写作类任务误判为不合规。
32
+ - F9 不做自动判定:编造检测需要语义理解而非结构校验,写成提示词级诚信约束,由三阶段门禁与人工复核承担。
33
+
34
+ ## 4. 版本与提交
35
+
36
+ | 项目 | 值 |
37
+ |---|---|
38
+ | package.json version | 2.1.0 |
39
+ | meta.version(src/host.ts) | 2.1.0 |
40
+ | git commit | c7e8f64 |
41
+ | git tag | v2.1.0 |
42
+ | 远程 | `git@github.com:abbaababa/dsh-workplan.git`(main) |
43
+
44
+ 版本同步点(与 `tests/version-sync` 一致):`package.json`、`package-lock.json` 两处、`src/host.ts` 的 `meta.version`、`tests/fixtures/tool-surface.json`、README 三语的安装命令与徽章、CHANGELOG 的 `## 2.1.0 — 2026-11-06` 标题。
45
+
46
+ ## 5. 验证
47
+
48
+ - `npm run check`(tsc -p tsconfig.json --noEmit):退出码 0。
49
+ - `npm test`:tests 578 / pass 578 / fail 0(含新增 `tests/workplan-comm-format.test.ts`)。
50
+ - 新增用例覆盖:规范下发一致性(提示词含 renderCommFormatSpec 全文与 F1–F9)、F1–F8 逐条拒收、F6 边界(纯 note 合法)、合规零违规、退回 blocked/comm-format 与通知文案、`requirePhases:false` 兼容、版本契约稳定性。
51
+ - 既有用例按新契约前移 1 条:`tests/workplan-evidence-contract.test.ts` 的 C-19 由「空证据 pass 降级 unverified 仍算 done」改为「按 F4 退回 blocked/comm-format」。
52
+ - `npm run build` 重新生成 `lib/`、`dist/`、`client.js`,`lib/comm-format.js` 新增,`lib/host.js` 内 version 为 2.1.0。
53
+
54
+ ## 6. 发布渠道
55
+
56
+ | 渠道 | 状态 | 证据 |
57
+ |---|---|---|
58
+ | npm | 已发布 | registry 元数据 `dist-tags.latest` = 2.1.0,`versions["2.1.0"]` 存在(`https://registry.npmjs.org/dsh-workplan`,直接查询,非 CLI 缓存) |
59
+ | GitHub Release | 已发布 | https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0 |
60
+ | Release 制品 | 已上传且校验一致 | `dsh-workplan-2.1.0.tgz`,sha256 `0f015202575999b4be428bd55f2349f676a88ad48c605727cbd6e8494c9ac261`;用 `gh release download` 重新下载后本地复算一致;GitHub 侧记录 `digest: sha256:0f015202…` 相同 |
61
+ | npm tarball sha1 | 与本地 pack 一致 | `afc59da063e210f03eb0424b00da6e594f8536eb`(npm publish 输出与本机 `npm pack` 输出相同) |
62
+
63
+ 说明:`npm view` 使用的本地 CLI 缓存可能短时间仍返回 2.0.4,以 registry 原始响应为准(本记录的证据即取自此)。缓存刷新后 CLI 即一致。
64
+
65
+ ## 7. 复验命令
66
+
67
+ ```bash
68
+ # 1) npm registry 上的最新版本(原始元数据,绕过 CLI 缓存)
69
+ curl -s https://registry.npmjs.org/dsh-workplan | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{const j=JSON.parse(d);console.log(j['dist-tags'].latest, !!j.versions['2.1.0'])})"
70
+
71
+ # 2) 远程 tag
72
+ git ls-remote --tags origin | grep v2.1.0
73
+
74
+ # 3) 制品可下载且校验一致
75
+ gh release download v2.1.0 -p 'dsh-workplan-2.1.0.tgz' -D /tmp/recheck --clobber
76
+ shasum -a 256 /tmp/recheck/dsh-workplan-2.1.0.tgz # 期望 0f015202…
77
+
78
+ # 4) 本地复现验证
79
+ cd /Users/open/Documents/Stocks/plugins/dsh-workplan
80
+ npm run check && npm test
81
+ ```
82
+
83
+ ## 8. 回滚方案
84
+
85
+ - 代码:`git revert c7e8f64` 后推送 `main`;需要撤销 tag 时 `git tag -d v2.1.0 && git push origin :refs/tags/v2.1.0`。
86
+ - npm:72 小时内可 `npm unpublish dsh-workplan@2.1.0`(已发布版本超过 72 小时不可撤,改用 `npm deprecate dsh-workplan@2.1.0 "…"` 标注问题并发布修复版)。
87
+ - 用户侧:安装旧版 `npm i dsh-workplan@2.0.4`;GitHub Release 可删除 v2.1.0 资产。
88
+
89
+ 风险提示:版本一旦被下游安装,撤回不能从已安装环境消失,回滚应以「发修复版」为主,`unpublish` 仅用于发布后立刻发现的严重错误。
90
+
91
+ ## 9. 已知问题(如实记录)
92
+
93
+ 本次会话中,dsh-workplan 的**自动任务分解**(它自己驱动的部门子 Agent)连续失败,计划 `wp-b7750256`(10 项)与 `wp-80e484d9`(9 项)全部子任务为 blocked,错误均为基础设施层:`cannot get required service "subagents" in inactive context` 与 `子 Agent 结束状态为 error`。子 Agent 未产生任何代码改动;2.1.0 的全部实现、测试与发布均由主 Agent 在本会话直接完成。
94
+
95
+ 这不影响 2.1.0 的代码正确性(578 条用例含专门的门禁用例全部通过),但说明「子 Agent 调度链路」在本机当前环境不可用,需在后续版本或部署侧单独排查。
package/lib/host.js CHANGED
@@ -1363,7 +1363,7 @@ export function apply(ctx, config = {}) {
1363
1363
  }
1364
1364
  export const meta = {
1365
1365
  name,
1366
- version: '2.1.0',
1366
+ version: '2.1.1',
1367
1367
  promptOrder: PROMPT_ORDER,
1368
1368
  routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
1369
1369
  };
package/lib/runtime.js CHANGED
@@ -1015,6 +1015,18 @@ async function executeSubtask(ctx, record, stage, subtask, options) {
1015
1015
  message: rejectedRow.error,
1016
1016
  };
1017
1017
  }
1018
+ else if (record.commFormatRejections && typeof record.commFormatRejections === 'object') {
1019
+ /*
1020
+ * [2.1.0] 续跑路径:受阻行已被 `resetBlockedStatuses` 重置,退回原因
1021
+ * 保存在本轮的 `commFormatRejections` 里(见 dispatchPlan 的重置前置抄写)。
1022
+ * 消费一次即删,避免同一条退回通知被后续任意一次重试重复带上。
1023
+ */
1024
+ const stored = record.commFormatRejections[String(subtask.id)];
1025
+ if (typeof stored === 'string' && stored.trim() !== '') {
1026
+ lastFailure = { attempt: 1, code: 'COMM_FORMAT_REJECTED', message: stored };
1027
+ delete record.commFormatRejections[String(subtask.id)];
1028
+ }
1029
+ }
1018
1030
  }
1019
1031
  /*
1020
1032
  * [1.8.6] The interrupt has to outlive the thrown error.
@@ -1763,7 +1775,29 @@ export async function dispatchPlan(ctx, record, options) {
1763
1775
  const repairing = record.phase === 'blocked';
1764
1776
  if (repairing)
1765
1777
  record.resumeCount = Number(record.resumeCount ?? 0) + 1;
1778
+ /*
1779
+ * [2.1.0] 格式退回通知必须先抄下来,再重置受阻行。
1780
+ *
1781
+ * 用户 2026-11-06 的要求是「不符合要求立刻退回,通知其重新检查格式」。
1782
+ * `resetBlockedStatuses` 会把受阻行清成待跑(blockedKind / error 一并清掉),
1783
+ * 于是 executeSubtask 再也看不到「上一次是格式退回」,退回通知永远送不到
1784
+ * 部门人员——退回就只剩状态行上一个记号。这里在重置前把退回原因按子任务
1785
+ * 抄进本轮记录,由 executeSubtask 消费并随提示词发回;重置后这条信息仍
1786
+ * 生效于下一次激活,消费一次即删,不会污染后续无关重试。
1787
+ */
1788
+ const rejectedForRedo = [];
1789
+ for (const row of Array.isArray(record.statuses) ? record.statuses : []) {
1790
+ if (row?.blockedKind === 'comm-format' && typeof row?.error === 'string' && row.error.trim() !== '') {
1791
+ rejectedForRedo.push([String(row.subtaskId), row.error]);
1792
+ }
1793
+ }
1766
1794
  record.statuses = resetBlockedStatuses(record.statuses);
1795
+ if (rejectedForRedo.length > 0) {
1796
+ record.commFormatRejections = {
1797
+ ...(record.commFormatRejections && typeof record.commFormatRejections === 'object' ? record.commFormatRejections : {}),
1798
+ ...Object.fromEntries(rejectedForRedo),
1799
+ };
1800
+ }
1767
1801
  // A resume produces a new durable outcome; without clearing this flag the
1768
1802
  // second result message was never written and a page refresh replayed the
1769
1803
  // stale blocked state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workplan",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Automatic task decomposition, real department subagents, and a responsive workplan dashboard for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/host.ts CHANGED
@@ -1490,7 +1490,7 @@ export function apply(ctx: any, config: WorkplanConfig = {}) {
1490
1490
 
1491
1491
  export const meta = {
1492
1492
  name,
1493
- version: '2.1.0',
1493
+ version: '2.1.1',
1494
1494
  promptOrder: PROMPT_ORDER,
1495
1495
  routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
1496
1496
  }
package/src/runtime.ts CHANGED
@@ -1066,6 +1066,17 @@ async function executeSubtask(ctx: any, record: any, stage: any, subtask: any, o
1066
1066
  code: 'COMM_FORMAT_REJECTED',
1067
1067
  message: rejectedRow.error,
1068
1068
  }
1069
+ } else if (record.commFormatRejections && typeof record.commFormatRejections === 'object') {
1070
+ /*
1071
+ * [2.1.0] 续跑路径:受阻行已被 `resetBlockedStatuses` 重置,退回原因
1072
+ * 保存在本轮的 `commFormatRejections` 里(见 dispatchPlan 的重置前置抄写)。
1073
+ * 消费一次即删,避免同一条退回通知被后续任意一次重试重复带上。
1074
+ */
1075
+ const stored = record.commFormatRejections[String(subtask.id)]
1076
+ if (typeof stored === 'string' && stored.trim() !== '') {
1077
+ lastFailure = { attempt: 1, code: 'COMM_FORMAT_REJECTED', message: stored }
1078
+ delete record.commFormatRejections[String(subtask.id)]
1079
+ }
1069
1080
  }
1070
1081
  }
1071
1082
  /*
@@ -1803,7 +1814,29 @@ export async function dispatchPlan(ctx: any, record: any, options: any) {
1803
1814
  */
1804
1815
  const repairing = record.phase === 'blocked'
1805
1816
  if (repairing) record.resumeCount = Number(record.resumeCount ?? 0) + 1
1817
+ /*
1818
+ * [2.1.0] 格式退回通知必须先抄下来,再重置受阻行。
1819
+ *
1820
+ * 用户 2026-11-06 的要求是「不符合要求立刻退回,通知其重新检查格式」。
1821
+ * `resetBlockedStatuses` 会把受阻行清成待跑(blockedKind / error 一并清掉),
1822
+ * 于是 executeSubtask 再也看不到「上一次是格式退回」,退回通知永远送不到
1823
+ * 部门人员——退回就只剩状态行上一个记号。这里在重置前把退回原因按子任务
1824
+ * 抄进本轮记录,由 executeSubtask 消费并随提示词发回;重置后这条信息仍
1825
+ * 生效于下一次激活,消费一次即删,不会污染后续无关重试。
1826
+ */
1827
+ const rejectedForRedo: Array<[string, string]> = []
1828
+ for (const row of Array.isArray(record.statuses) ? record.statuses : []) {
1829
+ if (row?.blockedKind === 'comm-format' && typeof row?.error === 'string' && row.error.trim() !== '') {
1830
+ rejectedForRedo.push([String(row.subtaskId), row.error])
1831
+ }
1832
+ }
1806
1833
  record.statuses = resetBlockedStatuses(record.statuses)
1834
+ if (rejectedForRedo.length > 0) {
1835
+ record.commFormatRejections = {
1836
+ ...(record.commFormatRejections && typeof record.commFormatRejections === 'object' ? record.commFormatRejections : {}),
1837
+ ...Object.fromEntries(rejectedForRedo),
1838
+ }
1839
+ }
1807
1840
  // A resume produces a new durable outcome; without clearing this flag the
1808
1841
  // second result message was never written and a page refresh replayed the
1809
1842
  // stale blocked state.