A log of a problematic run of a prefixing (roxygen) pal in Positron using these changes. Search for the first instance of key_get()—modifyRange() attempts to add a "#' @" in its sixth line, but the rstudioapi::getActiveDocumentContext() call immediately after it doesn't find it (and instead finds the line that follows what should be there) and instead picks up key_get <- ..., which is erroneously replaced in the next iteration.
io$last_run
$before
$before$row_start_end
[1] 1 1
$before$before