[APO-2622] Fix serialization of workflow input references in dataset scenarios#3468
Draft
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Draft
[APO-2622] Fix serialization of workflow input references in dataset scenarios#3468devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
When a sandbox.py file has Inputs references (like Inputs.message), the DatasetRow.serialize_inputs method now properly serializes them using the serializer from the context. This fixes the issue where scenarios with just Inputs references were not being serialized correctly. The fix checks if the value is a BaseDescriptor instance before using the serializer, so constant values continue to be serialized as-is. Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
dvargas92495
requested changes
Dec 29, 2025
| from .workflow import Inputs, TestDatasetWithInputReferencesWorkflow | ||
|
|
||
| if __name__ == "__main__": | ||
| raise Exception("This file is not meant to be imported") |
Contributor
There was a problem hiding this comment.
DevinAI this is no longer convention, we now do the following at the bottom:
if __name__ == "__main__":
runner.run()| raise Exception("This file is not meant to be imported") | ||
|
|
||
| dataset: List[Union[BaseInputs, DatasetRow]] = [ | ||
| Inputs(message=Inputs.message, count=Inputs.count), |
Contributor
Contributor
Author
There was a problem hiding this comment.
I've addressed both comments:
- Updated the sandbox.py convention to move
if __name__ == "__main__": runner.run()to the bottom - Fixed the test case to use
dataset = [Inputs](the class itself) instead ofInputs(message=Inputs.message, count=Inputs.count)- this matches the actual repro case
I also added the necessary handling in three places:
serialize_module- detects when a dataset entry is aBaseInputssubclass and converts it to an instanceDatasetRow.serialize_inputs- uses the serializer from context forBaseDescriptorvaluesWorkflowSandboxRunner- updated type annotation and runtime handling to support thedataset = [Inputs]pattern
All CI checks are now passing.
Address PR feedback: - Fix serialize_module to handle when dataset contains BaseInputs subclass (e.g., [Inputs]) instead of just instances - Update test case to use dataset = [Inputs] pattern matching actual repro - Fix sandbox.py convention: move if __name__ to bottom with runner.run() Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
Update the type annotation and runtime handling to support the pattern where users pass the Inputs class itself (e.g., dataset = [Inputs]) instead of an instance. This matches the actual user pattern shown in the repro case. Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
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.

Fixes an issue where sandbox.py files with
dataset = [Inputs](the class itself, not an instance) were not serializing scenarios correctly. The fix adds handling in three places:serialize_module- detects when a dataset entry is aBaseInputssubclass and converts it to an instance where each field is set to its correspondingWorkflowInputReferenceDatasetRow.serialize_inputs- uses the serializer from context forBaseDescriptorvalues to properly convert them toWORKFLOW_INPUTtype descriptorsWorkflowSandboxRunner- updates type annotation to acceptType[BaseInputs]and adds runtime handling to support thedataset = [Inputs]patternReview & Testing Checklist for Human
__annotations__captures all fields correctly (including inherited fields) - this is used in 3 places and could miss inherited fieldsdataset = [Inputs]pattern to verify scenarios appear correctly in the UINotes