you are mixing things together. That is not a name attribute on the primitives. That is a path attribute. You name attribute exists on the points. Each individual cube is represented by a point. This is what happens when you pack the geometry.
So in order to color some of the cubes for instance you need the sop solver to be attached to the rigid body solver. Not the constraint solver. (unless you are trying to color the constraint primitives.) See below
Lastly in order to access the cube geometry (the points) you need to work from the dop_geometry node inside the sop solver and not the Impacts.
Once all of that has been setup you can then write your code.
Your code should look something like this:
Take note of the fact that the wrangle node is running over the points and not primitives. Since your geometry is packed I only have one point or one primitive available per cube. The name attribute exists on the points, so we have to run over points. A simple string condition does the trick to isolate the desired cubes.
Inside the if statement I choose to add my color attribute to the primitive instead of the point which I am running over. This is simply just because Houdini is not very good at displaying colors that sits as a point attribute when dealing with packed geometry. So in order for it to show in the viewport I added the color in a primitive attribute instead.