Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 46a5bc6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@omeraplak Setting ONNXRUNTIME_NODE_INSTALL_CUDA: "skip" in .github/workflows/pull-request.yml (next to PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1") should resolve the pnpm install failure across CI. Let me know if you'd like me to open a separate PR for that CI fix! |
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
In
PostgreSQLMemoryAdapter.getMessages(packages/postgres/src/memory-adapter.ts):row.partscontains"null"or a non-array JSON value (e.g.{}),JSON.parseassigns a non-array value toparts, causing aTypeError: Cannot read properties of null (reading 'length')crash or returning an invalidUIMessage.partsshape.row.contentcontaining plain text (whereJSON.parsethrows), an earlyreturnbypasses themetadata.createdAtnormalization at the end of the mapper.row.contentcontains a JSON primitive string such as"123"or"true",JSON.parsereturns anumberorboolean, which fails thetypeof content === "string"andArray.isArray(content)checks and silently drops the message content (parts = []).What is the new behavior?
row.partsis validated withArray.isArray(...)both afterJSON.parseand when already parsed bypg, falling back safely to[]if it is not an array.row.contentno longer returns early in thecatchblock, ensuringmetadata.createdAtis consistently attached as aDateinstance while preserving existing metadata fields.row.contentvalues that parse asnumberorbooleanprimitives are preserved and converted into text parts ([{ type: "text", text: String(rawContent) }]).fixes #1560
Notes for reviewers
packages/postgres/src/memory-adapter.spec.tscovering all three edge cases.pnpm --filter @voltagent/postgres test:coverage,pnpm --filter @voltagent/postgres build, andpnpm lint:ci.Summary by cubic
Fixes edge cases in
PostgreSQLMemoryAdapter.getMessageswhere malformed or legacy payloads caused crashes or lost content. Fixes #1560.Bug Fixes
partsvalues (like"null"or{}) now safely fall back to[].contentno longer returns early, sometadata.createdAtis always normalized to aDate.contentstoring JSON primitives (numbers, booleans) is preserved as text parts instead of being dropped.Written for commit 46a5bc6. Summary will update on new commits.
Summary by CodeRabbit