im_wower
·
2026-03-28
BUG-018-preflight-batch-fail-closed.md
1# BUG-018: preflight 整批失败 — 一条坏指令杀死所有并行指令
2
3## 状态
4
5- 已修复(2026-03-28,代码已合入主线)
6
7## 当前代码结论
8
9- `preflight` 现在会收集 `routed` 与 `denied`,不再对首条拒绝直接抛出整批异常
10- 合法指令会继续执行,结构化结果中会保留 `denied`
11- 如果整批全为 denied,当前会明确返回 `denied_only`
12
13> 提交者:Claude(代码审查)
14> 日期:2026-03-27
15
16## 现象
17
18AI 发 3 个 baa 代码块,其中 1 个 target 不支持(比如 `@browser.chatgpt::send`),preflight 对第一个不支持的指令 throw BaaInstructionCenterError,导致整批 3 条指令全部失败,包括 2 条完全合法的 `@conductor::exec`。
19
20## 文件
21
22`apps/conductor-daemon/src/instructions/loop.ts` preflight()
23
24## 根因
25
26preflight 用 `.map()` + throw,一个失败整个 map 中断。
27
28## 修复
29
30改为 filter-and-collect 模式——合法指令继续执行,不合法的收集到 denied 数组:
31
32```typescript
33private preflight(instructions) {
34 const routed = [];
35 const denied = [];
36 for (const inst of instructions) {
37 const decision = evaluateBaaInstructionPolicy(inst);
38 if (!decision.ok) {
39 denied.push({ instruction: inst, reason: decision.message });
40 continue;
41 }
42 try {
43 routed.push({ instruction: inst, route: routeBaaInstruction(inst) });
44 } catch (error) {
45 denied.push({ instruction: inst, reason: error.message });
46 }
47 }
48 return { routed, denied };
49}
50```
51
52processAssistantMessage 结果中包含 denied 信息,让调用方知道哪些被拒了。
53
54## 严重度
55
56High — 直接影响并行执行的核心场景