Merge pull request #3130 from chengzhichao-xydt/codex/seahorse-marshal-errors

fix(seahorse): handle json.Marshal errors in grep and expand tools
This commit is contained in:
Mauro 2026-06-16 22:04:45 +02:00 committed by GitHub
commit c9f5872e02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -124,6 +124,9 @@ func (t *ExpandTool) Execute(ctx context.Context, args map[string]any) *tools.To
"tokenCount": result.TokenCount,
"messages": messages,
}
data, _ := json.Marshal(output)
data, err := json.Marshal(output)
if err != nil {
return tools.ErrorResult(fmt.Sprintf("failed to marshal expand result: %v", err))
}
return tools.NewToolResult(string(data))
}

View file

@ -167,6 +167,9 @@ func (t *GrepTool) Execute(ctx context.Context, args map[string]any) *tools.Tool
output["hint"] = result.Hint
}
data, _ := json.Marshal(output)
data, err := json.Marshal(output)
if err != nil {
return tools.ErrorResult(fmt.Sprintf("failed to marshal grep result: %v", err))
}
return tools.NewToolResult(string(data))
}