Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## 2025-06-24 - Runtime v0.18.1

- fix: subscribing to events should not be blocked by agent actor state [#910](https://github.com/hypermodeinc/modus/pull/910)
- fix: ensure valid UTF8 byte sequence for inference history [#911](https://github.com/hypermodeinc/modus/pull/911)

## 2025-06-23 - Runtime v0.18.0

Expand Down
21 changes: 12 additions & 9 deletions runtime/db/inferencehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,23 @@ func getInferenceDataJson(val any) ([]byte, error) {

// If the value is a byte slice or string, it must already have been serialized as JSON.
// It might be formatted, but we don't care because we store in a JSONB column in Postgres,
// which doesn't preserve formatting.
// which doesn't preserve formatting. For all other types, we serialize to JSON ourselves.

var bytes []byte
switch t := val.(type) {
case []byte:
return t, nil
bytes = t
case string:
return []byte(t), nil
bytes = []byte(t)
default:
if b, err := utils.JsonSerialize(val); err == nil {
bytes = b
} else {
return nil, err
}
}

// For all other types, we serialize to JSON ourselves.
bytes, err := utils.JsonSerialize(val)
if err != nil {
return nil, err
}
return bytes, nil
return utils.SanitizeUTF8(bytes), nil
}

func WritePluginInfo(ctx context.Context, plugin *plugins.Plugin) {
Expand Down
Loading