Skip to content

Commit 776abcb

Browse files
fix: prevent panic on missing step_id in plan_update
1 parent d1532e5 commit 776abcb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/aiusechat/tools_utils.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,13 @@ func GetWaveUtilsToolDefinition(tabId string) uctypes.ToolDefinition {
163163
return aiplan.FormatPlanStatus(plan), nil
164164

165165
case "plan_update":
166-
stepId := int(params["step_id"].(float64))
166+
stepIdRaw, ok := params["step_id"].(float64)
167+
if !ok || stepIdRaw == 0 {
168+
return "", fmt.Errorf("step_id required (must be a number)")
169+
}
170+
stepId := int(stepIdRaw)
167171
status, _ := params["status"].(string)
168172
result, _ := params["result"].(string)
169-
if stepId == 0 {
170-
return "", fmt.Errorf("step_id required")
171-
}
172173
if status == "" {
173174
status = aiplan.StatusDone
174175
}

0 commit comments

Comments
 (0)