Session Timeout
Your administrator sets how long your Positron Pro session can be idle before it closes automatically (times out). This is called the session timeout. As long as you are actively working in Positron Pro, the timeout is paused and your session stays open. For examples of what counts as user activity, see the What counts as activity section.
Understanding session timeout
To determine how long your session can be idle before it is terminated, use the UI in your Positron Pro session to check the timeout value.
If session timeout is enabled, an icon appears next to the Posit Workbench home page button in the bottom left corner of the status bar.
If the timeout icon does not display, your administrator has not enabled session timeouts and the functionality on this page does not apply to your session. Your sessions remain active until you manually close them.
Hover your mouse over the Posit Workbench home button or the timeout icon to display the duration before the session times out. While actively using your session, this value remains at the setting your administrator configured Workbench to use.
What counts as activity
When actively using your session, the session timeout is paused. The following actions are considered activity:
- Typing in any editor window or terminal.
- Clicking anywhere in the Positron Pro UI (menus, tabs, editors, etc.).
- Running Jupyter Notebook (including cell computations that may run for a long time).
- Running commands in the R or Python console:
- When you close the browser window, your session displays as idle to Workbench even if the session is active and your console command is still running.
What does not count as activity
Because of the limitations of the VS Code API used by Positron Pro sessions, the following actions are not able to be detected as activity. This list is not exhaustive:
- Scrolling (but not clicking) the editor.
- Using the mouse to navigate over (but not click) the editor.
- Running a long-running terminal command:
- Typing and pressing ENTER in the terminal counts as activity, but the command running without any further input does not.
- Running a long-running Python script:
- Typing the python command in the terminal or clicking the Run button in the editor counts as activity, but the script running does not.
- Clicking inside a rendered picture or plot in Jupyter notebook output:
- The plot is rendered in an
iframe
, so the VS Code API cannot detect clicks inside it.
- The plot is rendered in an
- Clicking on and using a Shiny app whether it’s displaying in Positron Pro’s browser or an external browser.
- Positron Pro’s internal browser view is rendered in an
iframe
, so the VS Code API cannot detect clicks inside it.
- Positron Pro’s internal browser view is rendered in an
Idle sessions
If your session is left unused for about 15 minutes (or you are only performing actions listed above in What does not count as activity) the status bar adds Idle to the timeout icon.
Hovering over the icon displays how much longer until your session times out. This is an indicator that your current workflow is not being detected as user activity. Performing any action listed in What counts as activity removes the Idle status.
If you continue to leave your session idle, another notification displays at least 30 minutes before it is set to timeout. This is the final warning that your session is about to be terminated.
Session timeout behavior
When your session passes the idle timeout threshold, Workbench automatically closes your session and removes it from the home page.
If your session was left open:
A notification displays that the session was quit.
Do not attempt to continue to use the session as none of your work will be saved.
Positron Pro user settings
To prevent losing unsaved work on session timeout, Positron Pro sessions rely on the Auto Save and Hot Exit settings being enabled. Set Auto Save to afterDelay
(you can specify any value for the delay, but the higher the value, the greater the risk of losing unsaved data from automatic idle session termination). Set your Hot Exit setting to onExitAndWindowClose
.
If you have these settings set to some other value, the extension notifies you and offers to fix them for you.
Common questions
Why did my session timeout while running a long R or Python cosole command?
You might have closed the brower. Running R or Python commands in the Positron Pro console does count as activity (even a long-running command that doesn’t require user input). However, closing the browser window terminates the Workbench extension process. The extension is what reports active sessions to Workbench, so if it’s shut down the session appears idle to Workbench. This is a known limitation and the workaround is to keep your browser window open.
How do I run a long-running command or script without my session timing out?
Use the Workbench Jobs feature. If you start a long-running command or script in the terminal and then leave your session, your session could timeout before the command or script finishes. Even if your long-running command does finish before the timeout out, your session could time out before you’re able to view any console output.
Using the Workbench Jobs feature to run the command or script asynchronously and external to your session allows the script to take as long as it needs to run, and the output is saved in the Jobs tab for you to view later.
Does Workbench track what I’m doing?
No. Your Positron Pro session can detect some user activity but does not track your activity for session timeouts. Specifically, Workbench monitors a timestamp of your activity (defined in the What counts as activity) section. Still, it does not know anything else about what that action was.