BLOCKER for the whole WiVRn lane. Everything else under #781 waits on this.
pkg/provider/alvr_other.go:7-13 stubs out tickALVR, xrStartupEvidenceCheck and superviseXROffline on every non-Windows platform. The engine is in pkg/provider/alvr_windows.go (953 lines) behind //go:build windows.
A WiVRn body therefore advertises xr_drivers:["wivrn"] honestly, the cluster matches a head to it and writes an XR directive into the body status response, and the body drops the directive on the floor. storeXRDirective is reachable (it is in the platform-neutral alvr.go) but takeXRDirective is only called from tickALVR, which does nothing here. wivrnArm in pkg/provider/wivrn_linux.go:14 is dead code reached by no path.
Symptom on hardware: the head requests a session, the cluster says requested, the body never moves to arming, and the head sits until its connect timeout.
The file divides cleanly at resolveSteamPath (line 624).
Driver-agnostic, lines 44 to 623, these move to a new pkg/provider/xr_session.go with no build tag:
tickALVR (rename, it is the generic tick), xrAdoptDirective, xrStartupEvidenceCheck,
startXRArm, armXR, superviseXROffline, superviseXR, xrEnterActive,
teardownXR, stateLabel, postXRStatusNow
ALVR and Windows only, lines 624 onward, these stay put:
resolveSteamPath, alvrStartChain, alvrLaunchDashboard, alvrLaunchSteamVR,
resolveVRStartup, alvrDashboardRequest, alvrTrustClient, alvrClientConnected,
alvrDashboardShowsConnected, alvrStreamSocketConnected, alvrOpenvrPathsFiles,
alvrDriverRegistered, alvrRegisterDriver, alvrUnregisterDriver, superviseALVRChain
Three more need a platform twin rather than a move:
quiesceSunshineForXR already has a Linux handle. desktop_linux.go was generalised to
desktopService(action, unit), so stopping hydra-sunshine.service on Linux is one call.
xrResolveExperienceExe and xrEnsureExperienceRunning are not needed on the WiVRn lane at
all: WiVRn launches the application itself from its own config. See the config render child.
stop_linux.go already carries killExperienceProcesses for teardown, matching the resolved
/proc//exe because comm truncates at 15 characters.
Put arm, disarm, serving and clientConnected behind a small interface chosen by the directive's Driver field. wivrn_linux.go already supplies three of the four. alvr_windows.go supplies the ALVR implementation. The state machine itself stops knowing which driver it drives.
Note alvr_windows.go:179 already rejects a directive whose Driver is not alvr, so the dispatch point exists; it just needs to select rather than reject.
xrCapable in alvr.go:57 requires the alvr role AND the ALVR install directory, so it is false on Linux by construction. Do not widen it: xrDrivers in wivrn.go:52 is the function that ORs the two capabilities together, and it is already correct. The guards at alvr_windows.go:47 and :141 are the ones that need to become driver-aware.
An Omarchy body with the wivrn role moves through arming, armed, active and draining on a real session, and a Windows ALVR body still behaves byte for byte as it does today. Unit coverage for the state machine runs on Linux, which it cannot do at all now.
How to start this with no prior context
Read #796 first for the system, the vocabulary and the hard rules. Then this. You need nothing else.
Set up
If
go buildfails withno space left on device, stop and tell the owner. Do not clear~/go/pkg/mod, because re-fetching private dependencies needs a per-repoGOPRIVATE_TOKEN.Establish the baseline BEFORE you touch anything
This change is a refactor of code that runs on Windows bodies that are live in venues. The only acceptance that matters is that the ALVR path still behaves identically. So record the baseline first:
All four must pass before you start. If they do not, that is a separate problem and this issue is blocked.
Read these three files before editing
pkg/provider/alvr_windows.go(953 lines) is the engine being split. The issue body lists which function goes where.pkg/provider/alvr_other.go(13 lines) is the no-op stub that causes the bug. Read it first, it is the whole problem in one screen.pkg/provider/wivrn_linux.goalready supplieswivrnArm,wivrnDisarmandwivrnServing. Your job is to make something call them, not to write them.Also skim
pkg/provider/alvr.go, which is already platform-neutral and holds the state constants, the capability checks and the directive store. It shows the pattern to follow.What correct looks like
This is a behaviour-preserving move, not a redesign. Nothing about how an ALVR body behaves may change. The commit should be almost entirely cut and paste, plus an interface and a dispatch.
Specifically:
wivrnrole now reads the directive and callswivrnArm.Do not take the opportunity to improve the state machine while moving it. If you find a bug in it, file a separate issue and leave it behaving as it does.
How to prove it
A green build is not proof, and in this fleet a green build has three times proved nothing. Prove it on the hardware:
msi1060, an Omarchy machine in themobile-kitvenue. Reach it through the cluster API and cluster exec, not SSH.bxl1-test*districts. Never a production body or head.arming,armed,activeanddrainingon a real session, visible in its status reports to the cluster.Note that
activeis not reachable until #783 lands, since nothing yet detects that the headset connected. Reachingarmedwith the WiVRn server actually running is the bar for this issue.When you are done
masterdirectly. This repo uses no PR ceremony.