Skip to content

fix(mcp): validate_flow can report success when the build ends before all expected components complete #12757

Description

@shaun0927

Summary

lfx.mcp.server.validate_flow() can return valid: true even when the streamed build ends before all expected components complete.

Current behavior

The function computes the expected node count up front, but the final success path only returns:

  • valid: true
  • component_count: len(completed)
  • errors: []

If the stream emits one or more successful end_vertex events and then an early end, the function still reports success even though not every node finished.

Why this matters

validate_flow() is used as a server-side validation surface before downstream execution flows continue. A green result should mean the whole flow validated, not just the subset of components that happened to complete before the stream ended.

Minimal reproduction

I reproduced this locally on current main by patching:

  • _get_flow() to return a flow with 2 nodes
  • _get_client().stream_post() to emit:
    1. one successful end_vertex for node-1
    2. then end

Observed return value:

{'valid': True, 'component_count': 1, 'errors': []}

Expected behavior

If the build ends before all expected components complete, the result should be invalid, for example with an explicit error such as:

{
  "valid": False,
  "component_count": 1,
  "errors": [
    {"component_id": "flow", "error": "Build ended early: 1/2 components completed"}
  ]
}

Notes

Metadata

Metadata

Assignees

Labels

jiraThis issue has been logged in Jira for fix by the engineering team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions