Skip to content

Conversation

@clopen-set
Copy link
Contributor

@clopen-set clopen-set commented Jan 22, 2026

Prevent users from defining custom Outputs classes where an output references something from the parent class

class MyPromptNode(InlinePromptNode):
    class Outputs(InlinePromptNode.Outputs):
        custom_output: str = InlinePromptNode.Outputs.text

Here custom_output doesn't get resolved during execution and remains undefined. Separately, I think custom outputs for an InlinePromptNode will just get dropped during serialization and possibly should be forbidden

@clopen-set clopen-set marked this pull request as ready for review January 22, 2026 15:56
Comment on lines 78 to 80
class_outputs = vars(node_cls.Outputs)

for name, value in class_outputs.items():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] we support iterating over the node class: for reference, value in node_cls.Outputs:

continue

parent_node_class = node_value.outputs_class.__parent_class__
if parent_node_class in node_cls.__mro__:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to reference a sibling value in the same Outputs class? e.g.

class CustomNode(BaseNode):
    class Outputs:
        a: str = SomeOtherNode.Outputs.str_output
        b: str = a
    ...

From some quick testing the node_value for b points to SomeOtherNode.Outputs.str_output and it is correctly marked as valid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's just standard output referencing of upstream nodes and how final output nodes work

Validates that the node does not reference parent class outputs.
"""
errors = []
for node_output in node_cls.Outputs:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #3630 (comment)

we're iterating on a subclass of BaseOutputs and not an instance, so we need to fetch the values separately

continue

parent_node_class = node_value.outputs_class.__parent_class__
if parent_node_class in node_cls.__mro__:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's just standard output referencing of upstream nodes and how final output nodes work

@clopen-set clopen-set merged commit eefad4c into main Jan 23, 2026
9 checks passed
@clopen-set clopen-set deleted the barry/apo-2358-base-node-output-reference branch January 23, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants