Skip to content

fix(vscode-activity): keep the activity reporter running in Restricted Mode - #257

Draft
viniciusdc wants to merge 1 commit into
mainfrom
fix/vscode-reporter-untrusted-workspaces
Draft

viniciusdc wants to merge 1 commit into
mainfrom
fix/vscode-reporter-untrusted-workspaces

Conversation

@viniciusdc

Copy link
Copy Markdown
Contributor

Closes #256.

The activity reporter from #226 was disabled in VS Code's default Restricted Mode, so users who never clicked Trust got idle-culled while typing (repro in #256). This declares untrusted-workspace support so the reporter runs regardless of trust.

  • package.json: add capabilities.untrustedWorkspaces.supported: true and bump the extension to 0.1.1. The extension only listens to editor events and makes one local HTTP request, so it's safe to run untrusted.
  • extension.js: only count window-state changes into focused/active. Blur and going inactive were also counted as activity, which pushed an idle cull back by up to one timeout.
  • New unit test that fails if the capability is dropped.

Not in this PR: gating the proxy opt-out on an activation marker written by activate() instead of on the install directory (the second half of #256). That one needs a decision on first-spawn behavior, so I'd rather do it separately.

Testing

  • pytest tests/unit: 182 passed. The new test fails against the manifest on main.
  • node --check on extension.js, and build-vsix.py packages the new manifest (version 0.1.1, capability present).
  • Still to do before marking ready: rerun the Restricted Mode case in a browser against this PR's image (untrusted workspace + typing should keep last_activity moving past shutdownNoActivityTimeout, and the extension host log should show nebari.nebari-activity-reporter activating without trust).

…d Mode

code-server opens the user's home in Restricted Mode until they trust it,
and VS Code disables any extension that doesn't declare untrusted-workspace
support. With the reporter disabled but the /vscode/ proxy opt-out still in
place, VS Code traffic stopped counting as activity while nothing reported
real interaction, so users actively working in VS Code were idle-culled.

Declare capabilities.untrustedWorkspaces.supported (the extension only reads
editor events and makes one local HTTP request) and bump it to 0.1.1.

Also count only window-state transitions into focused/active. The event
fires on blur and when the window goes inactive too, and counting those
extended idle sessions by up to one timeout.

Add a unit test pinning the capability.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants