Repository navigation
fix(server): editors opened from a boot-started service get the desktop's session type - #39960
juliusmarminge wants to merge 2 commits into
Conversation
…_TYPE Reproduces #36781: the session display recovered from the systemd user manager omits XDG_SESSION_TYPE, so Electron editors fall back to X11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…op's session type Electron editors such as VS Code fall back to X11 on a Wayland session when XDG_SESSION_TYPE is missing, and render at a different scale. Recover it from the systemd user manager along with the display variables. Fixes #36781 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
The automated pipeline stopped on this pull request and will not merge it: the fix is written and reviewed, but proving it needs something no worker has:
It stays open for a person to finish or close. |
When T3's server runs as a lingering systemd user service that started before the graphical login, readGraphicalSessionEnv in apps/server/src/process/externalLauncher.ts recovers the desktop session's environment from the systemd user manager (over busctl) before launching an editor. It kept only DISPLAY, WAYLAND_DISPLAY and XAUTHORITY. Without XDG_SESSION_TYPE, Electron editors like VS Code fall back to X11 on a Wayland session and render at a different scale. The fix adds XDG_SESSION_TYPE to GRAPHICAL_SESSION_ENV_KEYS, so the launched editor gets the same session type as a desktop launch. It is a one-line change with no new parser or regex. The repro test from factory/repro-36781 (which adds XDG_SESSION_TYPE=wayland to the existing systemd user manager test) is kept: it failed before the change and passes after. The VS Code scale difference itself was not observed, because this VM has no Wayland compositor.
Fixes #36781
Reproduction on main
Commit cebdf39 (origin/main). Started
vp run devwith T3CODE_DEV_SEED=0 and DISPLAY, WAYLAND_DISPLAY, XDG_SESSION_TYPE and XAUTHORITY unset, to mimic a lingering systemd user service that started before the graphical login. A stubbusctlfirst on PATH returned what the systemd user manager returns after a Wayland login imports its environment ({"type":"as","data":["HOME=...","WAYLAND_DISPLAY=wayland-1","XDG_SESSION_TYPE=wayland","XDG_CURRENT_DESKTOP=Hyprland"]}). A stubcoderecorded its environment. In the web client I clicked 'Open in VS Code' in the thread details panel. The editor was launched with--new-window <project>and only WAYLAND_DISPLAY=wayland-1; XDG_SESSION_TYPE was absent even though the user manager provided it. Also extended the existing test 'a Linux editor launch without a display takes the desktop session's display from the systemd user manager' in apps/server/src/process/externalLauncher.test.ts with XDG_SESSION_TYPE=wayland; it fails on main because the launched editor env lacks XDG_SESSION_TYPE. The actual VS Code scale difference on a real Hyprland session was not observed here (no Wayland compositor on the VM); that part rests on the reporter's devicePixelRatio measurements.Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
Before the fix:
vp test run src/process/externalLauncher.test.ts -t "systemd user manager"(apps/server) → 1 failed. After:vp test run src/process/externalLauncher.test.ts→ 38 passed, 8 skipped.vp run check:changed→ format, lint, knip, graphql, typecheck (3 packages), test (2 files) all pass.Not in this change
Who did the work
Run by the t3code factory in T3 Code.