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:
- one successful
end_vertex for node-1
- 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
Summary
lfx.mcp.server.validate_flow()can returnvalid: trueeven 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: truecomponent_count: len(completed)errors: []If the stream emits one or more successful
end_vertexevents and then an earlyend, 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
mainby patching:_get_flow()to return a flow with 2 nodes_get_client().stream_post()to emit:end_vertexfornode-1endObserved 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
validate_flowwork in fix(mcp): validate_flow fast-fails and reports partial errors #12697 and fix(mcp): fix validation, session isolation, and update_flow_from_spec parity #12528, but it is not the same condition.