fix(tools): handle malformed OpenAI tool arguments - #1488
Closed
abhinav7x94 wants to merge 1 commit into
Closed
Conversation
Member
|
Included in #1594 with your commit and authorship intact, plus a We dropped Thanks @abhinav7x94. |
graphite-app Bot
pushed a commit
that referenced
this pull request
Aug 24, 2026
#1594) Cherry-picks four contributor PRs for `@supermemory/tools` onto one branch, and bumps the package to 2.2.0. - #1244 (@rajarshidattapy): `withSupermemory` accepts `options.apiKey` instead of only reading `SUPERMEMORY_API_KEY`, matching the Vercel, Mastra and Voltagent integrations. Unblocks secrets managers, edge runtimes and per-request keys. - #1574 (@Agnik47): re-exports `PromptTemplate`, `MemoryPromptData` and `WithSupermemoryOptions` from `ai-sdk`. `./vercel` is not a published subpath, so the documented custom-template example did not compile. - #1488 (@abhinav7x94): malformed tool-call JSON returns an error result instead of throwing out of the request. - #1507 (@abhinav7x94): VoltAgent `onEnd` awaits the conversation save, which was fire-and-forget and could be dropped when a serverless runtime tore down. Dropped the `middleware.test.ts` added by #1244. Note that editing `packages/tools/package.json` triggers the npm publish workflow on merge. Co-Authored-By: rajarshidattapy <138959719+rajarshidattapy@users.noreply.github.com> Co-Authored-By: Agnik47 <140933190+Agnik47@users.noreply.github.com> Co-Authored-By: abhinav7x94 <204053250+abhinav7x94@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Why
OpenAI-compatible models can emit partial or invalid JSON in function arguments. The executor previously parsed outside its result flow, so a
SyntaxErrorescaped andPromise.alldiscarded sibling results.Validation
bunx vitest run src/openai/tools.test.ts src/tool-operations.test.ts --testTimeout 100000(16 passed)bun run buildbunx biome check packages/tools/src/openai/tools.ts packages/tools/src/openai/tools.test.tsgit diff --checkThe package-wide TypeScript command remains red on unrelated pre-existing dependency and example errors; it reports no errors in the new test or changed lines.