feat: v0.8.2 安全纵深补全 · 协议保真 · 断链修复 — 图片SSRF/根MEMORY.md保护根治 · Anthropic thinking回传+pause_turn续传 · 2523 用例全量回归 + E2E 扩充
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user