Session Timeout

Preview

Your administrator can configure a session timeout for your Positron session. This timeout is the amount of time that your session can appear idle before it is automatically closed by Workbench. As long as you are actively using your Positron session (see the What counts as activity section below for examples of what counts as user activity), the session timeout is paused.

Understanding session timeout

To determine how long your session can be idle before it is terminated, you can either reach out to your administrator or you can use the UI in your Positron 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.

Session timeout enabled

Session timeout enabled

Session timeout disabled

Session timeout disabled

If you do not see the timeout icon, your administrator has not enabled session timeouts and the features on this page don’t apply to your session. Your sessions remain active until you manually close them.

You can hover your mouse over either the Posit Workbench home button or the timeout icon to display a tooltip showing how long until your session times out. While actively using your session, this value remains at whatever setting your administrator configured Workbench to use.

What counts as activity

While you are 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 Positron’s UI (menus, tabs, editors, etc.)
  • Running Jupyter notebooks (including cell computations that may run for a long time)
  • Running commands in the R or Python console
    • If 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 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
  • Clicking on and using a Shiny app whether it’s displaying in Positron’s browser or an external browser
    • Positron’s internal browser view is rendered in an iframe, so the VS Code API cannot detect clicks inside it

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. The tooltip for the icon displays how much longer until your session times out. This doesn’t mean your session will terminate soon but it 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 user settings

To prevent losing unsaved work on session timeout, Positron sessions rely on the “autosave” and “hot exit” settings being enabled. Set autosave 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.

Tips and tricks

Why did my session timeout while running a long R or Python cosole command?

Running R or Python commands in the Positron console does count as activity–even a long-running command that doesn’t require user input. However, closing the browser window will also terminate the Workbench extension process. The extension is what reports active sessions to Workbench, so if it’s shut down the session will appear idle to Workbench. This is a known limitation. The workaround is to keep your browser window open.

How do I run a long-running command or script without my session timing out?

If you start a long-running command or script in the terminal and then leave your session, your session may timeout before the command or script finishes. Even if your long-running command does finish before the timeout out, your session may time out before you’re able to view any console output.

To avoid this, use the Workbench Jobs feature to run the command or script asynchronously and external to your session. Using this functionality, the script can 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 session can detect some user activity but does not track your activity for session timeouts. More specifically, Workbench monitors a timestamp of the last time you’ve done something listed in the What counts as activity section. Still, it does not know anything else about what that action was.

Back to top