frameLines
The frame block of one stack, ready to print: demapped, repeat-folded, then capped at MAX_FRAME_LINES. Shared by stack's walk and appendWatchdogTrace, which would otherwise hold the demap rules twice.
Fold before cap: the recursion the cap bounds is what the fold collapses, so it rarely fires at all. Capping first would drop 896 frames to save nothing and leave the fold's count understating the depth.
What collapses is everything below the LAST script frame: the path INTO the script, fixed by this mod's architecture rather than by anything the script did. The last, not the first — nested pumps put an outer eval's script frame below an inner one's plumbing (vanilla re-enters the pump, see TimeoutGuard.endFrame), and cutting at the first would swallow the reentrancy that explains the report.
No script frame, no cut. That is also the whole of the compile stage: a compile crash is read from the compiler's frames, and the run that called them is too short for a marker to pay for itself, so the same rule against the last compiler frame was tried and dropped rather than kept as a branch that never fires.