The reason why it happens when you have history is that when dealing with the API you need to add support for the DG.
When you call a method like setVertexFaceColor, it will set the color on the object that you asked it to, which is all well and good... But! if there is any history on that node, any DG evaluation will cause that object to lose the value you set - simply because it is a cascading evaluation:
node 1 --> node 2 --> node 3
node 3 gets its values from node 2, which gets its values from node 1. Any values on node 3 are only valid until the next evaluation. In order to do this properly to support history, rather than calling setVertexFaceColor() you want to create a node that can be inserted in the chain (when there is history) and insert it just ahead of your object. That way, you'll have something like:
node1 --> node2 --> myColorNode --> node3
where myColorNode intercepts the data from node2, sets the new colors directly on the passing datablock and then passes it to node3, which gets the newly updated values.
If you want to understand more (this was a really brief synopsis), you should read the API docs specifically on the DG. Also if you want an example of how your command should look, take a look at the Polygon API docs. It goes over a generic modifier command that abstracts out the difficulties of supporting history and tweaks.
Hope this helps.