fix(channels): check json marshal/unmarshal errors in toChannelHashes
Replace silently discarded json.Marshal and json.Unmarshal errors with explicit checks. If serialization fails, log a warning and either return early (for the config-level marshal/unmarshal) or skip the channel (for per-channel marshal). This prevents silent data loss when channel configuration contains unexpected types.
This commit is contained in:
1 parent
413d37494b
commit
7338df2cfb
2 files changed
+20
-5
No files matched your search
@@ -132,7 +132,11 @@ func RunToolLoop(
|
||||
Content: response.Content,
|
||||
}
|
||||
for _, tc := range normalizedToolCalls {
|
||||
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
||||
argumentsJSON, err := json.Marshal(tc.Arguments)
|
||||
if err != nil {
|
||||
logger.Warnf("toolloop: failed to marshal tool call arguments for %s: %v", tc.Name, err)
|
||||
argumentsJSON = []byte("{}")
|
||||
}
|
||||
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
||||
ID: tc.ID,
|
||||
Type: "function",
|
||||
|
||||
Reference in new issue
Block a user