fix(desktop): probe KVM backend once, fail closed on headless host #117
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-115-desktop-probe-once-fail-closed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
run_desktop entered the ~30 fps capture loop unconditionally. On a host with no graphical session every capture_changed_tiles tick returned KvmError::NotAvailable and the loop spun forever at frame rate, so the browser Desktop tab showed a blank canvas and the agent never told the client. VA-112 only throttled the log line; the spin and the silence remained.
Probe the backend once before the select loop, into a throwaway StreamState so a successful probe does not consume the first keyframe the loop must ship. If the probe returns NotAvailable, log one INFO line, close the WebSocket cleanly (the SPA's kvm_displays pre-flight plus DeskStatus render the headless state), and return without entering the loop. A working backend is unaffected: the loop starts after the first successful probe. A transient (non-NotAvailable) first-frame error falls through into the loop, where VA-112's rate-limiter still handles a backend that fails mid-session.
unavailable_reason isolates the fail-closed classification so the boundary (only NotAvailable fails closed) is unit-tested without a live capture backend.
#VA-115