I’m not sure what the function of this “box” is. It is directly over a load bearing wall. It looks like the studs that are sticking up are the same angle as the roof pitch.
Is it some kind of support? I don’t understand how it can support anything. It is not attached to the ridge or rafters anywhere.