Skip to content

fix(agent): VariableAggregator crashes on string variable selectors accepted elsewhere #19412

Description

@Harsh23Kashyap

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Describe your problem

VariableAggregator accepts variable selectors in two forms. VariableAggregatorParam.param_refs (used by the canvas for dependency ordering) handles both:

[selector.get("value") if isinstance(selector, dict) else selector for ...]

But _invoke indexes selector["value"] unconditionally:

for selector in group.get("variables", []):
    val = self._canvas.get_variable_value(selector["value"])

A canvas built through the SDK/API with plain string selectors ("variables": ["a@x"]) parses and orders correctly, then crashes at runtime:

TypeError: string indices must be integers

Reproduction

param.groups = [{"group_name": "G", "variables": ["a@x"]}]
component._invoke()
# TypeError: string indices must be integers

Expected behavior

Both selector forms resolve at runtime, consistent with param_refs.

Version

current main (commit d5ebaf6)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions