Skip to content

VS Code activity reporter is disabled in Restricted Mode, so untrusted users get culled while working #256

Description

@viniciusdc

Follow-up from #226, which fixes #208 but ships with the activity reporter disabled in VS Code's default state.

What happens

code-server opens /home/jovyan in Restricted Mode for new users/sessions. nebari-activity-reporter doesn't declare untrustedWorkspaces support, so VS Code disables it until the user clicks Trust. On the pack side nothing notices: _vscode_reporter_installed() in images/nebi/jupyter_server_config.py only checks that the extension directory exists, so the /vscode/ proxy opt-out (update_last_activity: False) still applies. A user who never trusts the folder gets culled at singleuserCuller.server.shutdownNoActivityTimeout while actively typing, with nothing in any log.

Repro from a local NIC (kind) run against 613a1f0, shutdownNoActivityTimeout: 180, Restricted Mode, typing continuously:

21:42:18  last_activity (VS Code opening)
21:43 ->  typing; last_activity never moves again
21:45:27  server self-terminates

The extension host log for that session shows other onStartupFinished extensions activating but never nebari.nebari-activity-reporter, and no "Nebari Activity Reporter" output channel is created. After trusting the folder (same image, same user) it activates right away and keeps the session alive with a ping every 60 to 80s.

Fix

Declare untrusted support in images/jupyterlab/vscode-activity-reporter/package.json. The extension only listens to editor events and makes one local HTTP request, so this is safe:

"capabilities": {
  "untrustedWorkspaces": { "supported": true }
}

I think the gate should also change from "the directory exists" to "the reporter actually ran": have activate() write a marker keyed to the extension version, and have jupyter_server_config.py require it before setting update_last_activity: False. That way any future activation failure degrades to over-spending instead of culling working users. Open question on how to handle the first spawn, since the marker can only exist after VS Code has been opened once.

Acceptance: in an untrusted workspace, typing in VS Code keeps last_activity moving and the pod alive past shutdownNoActivityTimeout.

Smaller items from the #226 review, same area

  • onDidChangeWindowState counts every state change as activity, including blur and going inactive. Only s.focused || s.active should count (inline suggestion on Interaction-based idle culling for VS Code (code-server) #226).
  • After a cull, VS Code loops "Attempting to reconnect" against a 302 to the hub, so the user never learns the server was stopped. Pre-existing, but Interaction-based idle culling for VS Code (code-server) #226 makes culling a VS Code session much more common; at least worth a line in the docs.
  • code-server queries open-vsx.org/vscode/gallery/vscode/nebari/nebari-activity-reporter/latest for updates (404 today). The installed copy is pinned, so probably no auto-update risk, but should we claim the nebari namespace on Open VSX?
  • Not yet verified in a browser: killing a terminal mid-command (the per-terminal Set fix) and the tab-closed path for CODE_SERVER_IDLE_TIMEOUT_SECONDS.

Related: #231 (moving the ping to the *_last_activity settings seam).

Activity

  1. added
    type: bug 🐛
    priority: medium ⚡
    needs: PR 📬
    size: S
    on Oct 2, 2026
  2. updated Size S, Start date 2026-10-02, Target date 2026-10-05 and Priority Medium on Oct 2, 2026
  3. added theissue type on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: user experience 👩🏻‍💻needs: PR 📬priority: medium ⚡size: Stype: bug 🐛

    Type

    Fields

    Priority

    Medium

    Start date

    Oct 2, 2026

    Target date

    Oct 5, 2026

    Size

    S

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions