Problem with shell in RStudio IDE 1.1.456 (Windows)

I run into a persistent problem with the shell (Tools >> Shell...). If I open the shell everything works fine. However, if I close it and then open it again. Things stop working. I was able to pin this down to a problem with the HOME environment variable

$ echo $HOME
/c/Users/mbojanowski

but after closing the session in opening it again I see

$ echo $HOME
/c/Users/mbojanowski/Documents/=

so clearly somehting is wrong with startup/environment. I have no idea how to debug it further.

Please help as it is very annoying -- I need to restart RStudio session if I accidentally close and re-open the shell window.

I came here to ask this exact question. I am experiencing this as well whenever I close and then reopen a shell in RStudio. The only way to fix it is to restart RStudio. I am using RStudio version 1.2.1335. Any guidance on how to resolve this would be greatly appreciated.

We're monitoring this issue here: https://github.com/rstudio/rstudio/issues/3663