Merge pull request #3057 from chengzhichao-xydt/codex/subagent-spawn-type-assertions
fix(tools): add ok checks for type assertions in subagent and spawn tools
This commit is contained in:
commit
0f86d9aacb
2 changed files with 12 additions and 3 deletions
|
|
@ -90,8 +90,14 @@ func (t *SpawnTool) execute(
|
||||||
return ErrorResult("task is required and must be a non-empty string")
|
return ErrorResult("task is required and must be a non-empty string")
|
||||||
}
|
}
|
||||||
|
|
||||||
label, _ := args["label"].(string)
|
label, ok := args["label"].(string)
|
||||||
agentID, _ := args["agent_id"].(string)
|
if !ok {
|
||||||
|
label = ""
|
||||||
|
}
|
||||||
|
agentID, ok := args["agent_id"].(string)
|
||||||
|
if !ok {
|
||||||
|
agentID = ""
|
||||||
|
}
|
||||||
targetAgentID := strings.TrimSpace(agentID)
|
targetAgentID := strings.TrimSpace(agentID)
|
||||||
|
|
||||||
// Check allowlist if targeting a specific agent
|
// Check allowlist if targeting a specific agent
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,10 @@ func (t *SubagentTool) Execute(ctx context.Context, args map[string]any) *ToolRe
|
||||||
return ErrorResult("task is required").WithError(fmt.Errorf("task parameter is required"))
|
return ErrorResult("task is required").WithError(fmt.Errorf("task parameter is required"))
|
||||||
}
|
}
|
||||||
|
|
||||||
label, _ := args["label"].(string)
|
label, ok := args["label"].(string)
|
||||||
|
if !ok {
|
||||||
|
label = ""
|
||||||
|
}
|
||||||
|
|
||||||
// Build system prompt for subagent
|
// Build system prompt for subagent
|
||||||
systemPrompt := fmt.Sprintf(
|
systemPrompt := fmt.Sprintf(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue