-
Notifications
You must be signed in to change notification settings - Fork 19.4k
fix: allow None values in VariableMessage validation #30082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow None values in VariableMessage validation #30082
Conversation
When calling a workflow as a tool, if any output variable has a null value, the tool invocation fails with "Only basic types and lists are allowed" error. This is because the VariableMessage validator only allows dict, list, str, int, float, and bool types, but does not allow None. Workflow End nodes can legitimately output null values for optional fields, so the validation should accept None as a valid value.
Summary of ChangesHello @krap730, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where workflow-as-tool invocations would fail if any output variable contained a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Note: This issue can also be worked around by ensuring that workflow outputs don't contain Whether to merge this fix is up to the maintainers' discretion - the workaround is a valid alternative if you prefer to keep the stricter validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request resolves a validation error that occurred when a workflow used as a tool returned null output variables. The change in api/core/tools/entities/tool_entities.py correctly updates the VariableMessage.transform_variable_value validator to permit None values, which was the root cause of the issue. The implementation is clean, and the accompanying updates to the docstring and error message are appreciated for maintaining code clarity. The fix is solid and I see no issues.
Summary
Fix workflow-as-tool invocation failing when output variables contain
nullvalues.Problem
When calling a workflow as a tool, if any output variable has a
nullvalue, the tool invocation fails with:Root Cause
In
api/core/tools/entities/tool_entities.py, theVariableMessage.transform_variable_valuevalidator only allowsdict | list | str | int | float | booltypes, but does not allowNone.When a workflow End node outputs contain
nullvalues (e.g.,{"result": "data", "optional_field": null}), theWorkflowTool._invoke()method passes theseNonevalues tocreate_variable_message(), which fails the validation.Solution
Update the validation to allow
Nonevalues by checkingif value is not Nonebefore the isinstance check.Related to #30069
Test Plan