Merge pull request #2575 from apple-ouyang/fix/issue-2571-subagent-safeguards

fix(delegate-task): add subagent turn limit and model routing transparency
This commit is contained in:
YeonGyu-Kim
2026-03-25 21:46:01 +09:00
committed by GitHub
2 changed files with 38 additions and 2 deletions
+15 -1
View File
@@ -149,9 +149,23 @@ export async function executeSyncTask(
const duration = formatDuration(startTime)
// 检测模型路由是否与父 session 不同,给用户可见的提示
const actualModelStr = categoryModel
? `${categoryModel.providerID}/${categoryModel.modelID}`
: undefined
const parentModelStr = parentContext.model
? `${parentContext.model.providerID}/${parentContext.model.modelID}`
: undefined
const modelRoutingNote =
actualModelStr && parentModelStr && actualModelStr !== parentModelStr
? `\n⚠️ Model routing: parent used ${parentModelStr}, this subagent used ${actualModelStr} (via category: ${args.category ?? "unknown"})`
: actualModelStr
? `\nModel: ${actualModelStr}${args.category ? ` (category: ${args.category})` : ""}`
: ""
return `Task completed in ${duration}.
Agent: ${agentToUse}${args.category ? ` (category: ${args.category})` : ""}
Agent: ${agentToUse}${args.category ? ` (category: ${args.category})` : ""}${modelRoutingNote}
---