How do I put a constraint on a bone affected by chain length?
Try using a Transformation constraint, this allows you to convert a location change into a rotation change.

In the following example I take the Z location of the arm bone with values between -0.3 and 0.3 and convert that to an rotation of the X axis of the shoulder bone from -5 to 5 degrees. Notice in the middle the Z source maps to the X destination.





For more control than that you can create a driver. You can define your own python functions to use in drivers to get as much control as you want.