PANSOPS VOL1 states that where a gradient greater than 3.3% is specified, the altitude or fix to which it extends shall be promulgated. Eg "gradient 4.4% to 1200' thence 3.3%". It is not necessarily the end of the SID but a point from where the standard 3.3% will provide MOC. Obviously if you have a stop altitude in the SID you comply with that but the procedure design is such that you will already have obstruction clearance in that case.
some say until 400ft, some say MSA, some say it's an average until the end of the SID and some say until SID STOP ALTITUDE
400' figure probably comes from min height for intial turn (or maybe 2nd segment). The gradient is definitely not "an average until the end of the SID" but a minimum to be maintained at all times (in normal ops). The answer to the question remains that the minimum gradient extends to the altitude or fix promulgated and the reference is PANSOPS VOL1.