Skip to content

refactor: Migrate existing nodes (Function/Tool/start + test nodes) to new Node interface#984

Open
hanorik wants to merge 1 commit into
v2from
hanorik/migrate_nodes
Open

refactor: Migrate existing nodes (Function/Tool/start + test nodes) to new Node interface#984
hanorik wants to merge 1 commit into
v2from
hanorik/migrate_nodes

Conversation

@hanorik
Copy link
Copy Markdown
Contributor

@hanorik hanorik commented Jun 8, 2026

This PR updates the workflow system's node architecture to adopt the new Node interface, delegating schema routing and config management to BaseNode, and consolidating validation in the scheduler.

Key Changes

  • Production Nodes Migration: Updated *FunctionNode, *ToolNode, and *startNode to satisfy the new Node interface by routing schemas and configurations through BaseNode.
  • Test Nodes Migration: Refactored all 10 test nodes (e.g., dummyNode, cancelObservingNode, retryTestNode, etc.) to satisfy the new interface, primarily via BaseNode embedding.
  • Consolidated Schema Validation: Removed lingering/redundant validation and conversion logic in execution paths (wrappedFn and runTool paths in function_node.go and tool_node.go). Input validation is now exclusively handled by the scheduler.
  • Test Alignment: Updated test suites (e.g., tool_node_test.go and agent_node_test.go) to accommodate new constructors and ensure input validation is invoked prior to running nodes where required.

Verification

  • All tests in the workflow package pass successfully:
    go test ./workflow/...

@hanorik hanorik requested a review from wolo-lab June 8, 2026 11:39
Comment thread workflow/function_node.go
} else {
typedInput, ok := input.(IN)
if !ok {
// Fallback to the json-like input types that cannot be converted by the standard type assertion.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think keeping it doesn't have drawbacks and makes the code more user friendly (e.g. no need to change workflow/agent_node_test.go and you can revert changes in TestToolNode_WorkflowIntegration at workflow/tool_node_test.go:

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.

2 participants