Uh oh!
There was an error while loading. Please reload this page.
fix(tool): Fix custom tools spreading out string output - #3676
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
TheodoreSpeaks
commented
Mar 19, 2026
@cursor review |
PR SummaryMedium Risk Overview
Written by Cursor Bugbot for commit eb8b17e. This will update automatically on new commits. Configure here. |
TheodoreSpeaks
commented
Mar 19, 2026
@cursor review |
Greptile SummaryThis PR fixes a bug where custom tool outputs that are strings (instead of objects) were being passed to The fix has two complementary parts:
Key concerns:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[executeTool called] --> B{isCustomTool?}
B -- Yes --> C["finalResult.output || {}"]
B -- No --> D["stripInternalFields(finalResult.output || {})"]
D --> E{typeof output === 'object'\nand not null\nand not Array?}
E -- No --> F[Return output as-is\n✅ strings/arrays pass through]
E -- Yes --> G[Iterate Object.entries\nStrip __ prefixed keys]
G --> H[Return filtered object]
C --> I{output is truthy?}
I -- Yes --> J[Return output unchanged\n✅ string/object preserved]
I -- No --> K["Return {} ⚠️ empty string / 0 / false lost"]
J --> L[Set result.output]
H --> L
K --> L
F --> L
Last reviewed commit: "Fix lint" |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
https://sim-ai.slack.com/archives/C09B82TTM7Y/p1773913304490249
We have a bug introduced with stripping double underscored fields. We incorrectly assumed these outputs would always be jsons, but custom tools can pass a string. This incorrectly spreads out the output into json character by character.
Fix:
Type of Change
Testing
Duplicated issue by creating custom tool that returns a string. Validated issue, then validated fix. Then validated that double underscore isn't stripped from custom tools.
Checklist
Screenshots/Videos