There seems to be a bug in recent versions of RStudio IDE where the console history (via up arrow) doesn't reliably bring back the last command run. It seems to skip lines sometimes. I can't quite isolate what is happening. It seems that maybe it skip lines that I enter directly into the console versus lines that come from the source pane, but I haven't reproduced the issue carefully enough to know for sure. I do know that it doesn't 100% skip these history lines.
This is happening in Version 2025.04.0-daily+168 (2025.04.0-daily+168), but was also happening in the most recent stable release.
Up arrow seems to be ignoring console inputs, and inserting other commands (maybe ones that caused errors?).
Somewhat useful workaround is to use cntrl + up (cmd + up on Mac) to get the recent history. This brings up recent console input, but it's also including some other commands simultaneously.
I cleared my history and deleted all of the .Rhistory files. Still getting some ghost commands as shown below.
This issue might be related to how RStudio handles command history between the console and source pane. You can try resetting the history by clearing the .Rhistory file (rm .Rhistory in the terminal) and restarting RStudio. Also, check Tools > Global Options > Code > Saving and adjust the history settings. If the issue persists, you may want to report it on the RStudio GitHub issues page with reproducible steps to help the developers debug it.