feat: v0.8.2 安全纵深补全 · 协议保真 · 断链修复 — 图片SSRF/根MEMORY.md保护根治 · Anthropic thinking回传+pause_turn续传 · 2523 用例全量回归 + E2E 扩充
CI / 类型检查 + Lint + 单元测试 (push) Failing after 9m45s
CI / 全量测试 (Electron ABI) (push) Failing after 6m28s
CI / 产物编译验证 (push) Successful in 11m18s

This commit is contained in:
2026-09-08 14:30:27 +08:00
parent 69776e447f
commit 4cd6e997b5
86 changed files with 4303 additions and 956 deletions
@@ -238,7 +238,7 @@ describe('TaskOrchestrator — 工具白名单', () => {
});
});
describe('TaskOrchestrator — 递归深度限制', () => {
describe('TaskOrchestrator — 并发委派上限', () => {
it('同一会话并发达到 3 层后,第 4 次委派被拒绝(同步计数)', async () => {
const { releases } = installLatchedAdapter();
@@ -248,7 +248,8 @@ describe('TaskOrchestrator — 递归深度限制', () => {
const d4 = await orchestrator.delegate({ description: 'L4', parentSessionId: 's' });
expect(d4.success).toBe(false);
expect(d4.result).toContain('depth limit');
// v0.8.2 P3-2: 文案如实描述为并发上限(非递归深度 —— SubAgent 无 delegate_task
expect(d4.result).toContain('concurrency limit');
expect(d4.iterations).toBe(0);
// 等三个引擎都挂起到闩锁再释放(过早释放会扑空)
@@ -86,7 +86,7 @@ interface SubAgentHandle {
getStatus: () => { taskId: string; status: string; description: string; depth: number };
}
/** 默认递归深度限制 */
/** 默认并发委派上限(每会话同时活跃的 SubAgent 数) */
const MAX_DELEGATION_DEPTH = 3;
export class TaskOrchestrator extends EventEmitter {
@@ -139,16 +139,21 @@ export class TaskOrchestrator extends EventEmitter {
const taskId = params.taskId ?? `sub_${nanoid(8)}`;
const startMs = Date.now();
// ===== 递归深度检查 =====
// ===== 并发委派上限检查 =====
// v0.8.2 P3-2 根治(语义对齐):sessionDepth 实际计数的是"该会话当前活跃的
// 委派数"finally 中恢复/清除),且 delegate_task 已从 SubAgent 工具集排除、
// 真实嵌套递归不可能发生 —— 旧文案"depth limit reached"误导排障方向
// (测试 engine-toolchain/orchestrator 按并发 3 层锁定该行为)。现文案与
// 注释如实描述为并发委派上限;README 的"3 层深度"措辞同步对齐。
const currentDepth = this.sessionDepth.get(params.parentSessionId) ?? 0;
if (currentDepth >= MAX_DELEGATION_DEPTH) {
log.warn(
`[Orchestrator] Delegation depth limit reached (${currentDepth}) for session ${params.parentSessionId}`,
`[Orchestrator] Concurrent delegation limit reached (${currentDepth}) for session ${params.parentSessionId}`,
);
return {
taskId,
parentSessionId: params.parentSessionId,
result: `SubAgent delegation depth limit reached (${MAX_DELEGATION_DEPTH}). Cannot delegate further.`,
result: `SubAgent concurrency limit reached (${MAX_DELEGATION_DEPTH} concurrent delegations per session). Wait for an active subtask to finish before delegating more.`,
success: false,
durationMs: 0,
iterations: 0,