fix(core): sanitize tool inputs before replay#1337
Conversation
🦋 Changeset detectedLatest commit: ac7d9c0 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 |
📝 WalkthroughWalkthroughThis PR fixes issue ChangesTool Input Sanitization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
Deploying voltagent with
|
| Latest commit: |
ac7d9c0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9190a6b6.voltagent.pages.dev |
| Branch Preview URL: | https://fix-issue-1336-tool-input-re.voltagent.pages.dev |
There was a problem hiding this comment.
1 issue found across 9 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
A malformed tool-call input can be persisted as a string in a UI tool part. When that conversation is later replayed to providers such as Anthropic, the historical
tool_use.inputis sent as a string instead of a dictionary/object, so the provider rejects the request.This can poison the conversation history: a later follow-up message can fail even though the original tool input error already happened on a previous turn.
What is the new behavior?
Tool-call inputs are normalized before they are saved or replayed:
{}Fixes #1336
Notes for reviewers
Validation run:
pnpm --dir packages/core test:single src/utils/tool-input.spec.ts src/utils/message-converter.spec.ts src/agent/message-normalizer.spec.tspnpm --dir packages/core typecheckpnpm --dir packages/core lint(passes with existing complexity warnings)pnpm --dir examples/base buildI removed the local repro from this PR and kept the coverage in focused regression tests.