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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Change Log

NOTE: all releases may include dependency updates, not specifically mentioned

## 2025-06-25 - Runtime v0.18.2

- fix: validate inference history is valid json [#916](https://github.com/hypermodeinc/modus/pull/916)

## 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)
Expand Down
4 changes: 3 additions & 1 deletion runtime/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func logDbWarningOrError(ctx context.Context, err error, msg string) {
logger.Warn(ctx).Msgf("Database has not been configured. %s", msg)
}
} else {
logger.Err(ctx, err).Msg(msg)
// not really an error, but we log it as such
// but user-visible so it doesn't flag in Sentry
logger.Err(ctx, err).Bool("user_visible", true).Msg(msg)
}
}

Expand Down
17 changes: 12 additions & 5 deletions runtime/db/inferencehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hypermodeinc/modus/runtime/plugins"
"github.com/hypermodeinc/modus/runtime/secrets"
"github.com/hypermodeinc/modus/runtime/utils"
"github.com/tidwall/gjson"

"github.com/hypermodeinc/modusgraph"
"github.com/jackc/pgx/v5"
Expand Down Expand Up @@ -161,21 +162,27 @@ func getInferenceDataJson(val any) ([]byte, error) {
// It might be formatted, but we don't care because we store in a JSONB column in Postgres,
// which doesn't preserve formatting. For all other types, we serialize to JSON ourselves.

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

return utils.SanitizeUTF8(bytes), nil
result = utils.SanitizeUTF8(result)

if !gjson.ValidBytes(result) {
return nil, fmt.Errorf("invalid JSON data: %s", result)
}

return result, nil
}

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