HydraIssues

hydrabody: experience windows are pinned to 1920x1080, so any head that requests a smaller stream gets the top-left crop
open bug Priority: high Project: hydrabody Reporter: 18 Oct 2026 16:00

Description

Symptom

On a 1920x1080 signage panel the experience is rendered oversized with only its top-left portion visible. The stream itself is clean: the client decoder reports 1280x720 crop=0,0-1279,719 shown=1280x720 stride=1280 and every surface matches the panel.

Observed on chunky-turnip-23 (node-b961f1c8, venue mobile-kit, hydrabody v2.0.73-rc.10) while investigating multi-slot work on 2026-10-18.

The virtual display is NOT the cause

The original suspicion was that the VDD never adopted the requested mode. It did. Sunshine's own log on the streaming slot, during the live session:

17:38:31.983  Debug: mode -- 1280x720x30
17:38:32.015  Info: Trying to apply display device settings. API is available: true
              "device_prep": "EnsurePrimary"
17:38:32.017  initial topology: [[{9925808e-...}],[{9acddf6d-...}],[{72d4c5a4-...}]]
17:38:32.271  Info: Desktop resolution [1280x720]
              Capture size : 1280x720

The display adopted 1280x720 in under 300 ms.

Warning about the measurement. [System.Windows.Forms.Screen]::AllScreens run through the hydracluster exec API reports a single WinDisc display at 1024x768. That is session 0's console pseudo-display, which the exec channel runs in. No stream ever captures it. Anyone measuring display geometry through exec will see 1024x768 on any body and conclude the VDD is stuck. Read Sunshine's own log instead.

Actual cause

C:\sunshine\config\apps.json on chunky, written by hydrabody:

"cmd": "...\\RomeinsMuseum.exe -ResX=1920 -ResY=1080 -windowed -ForceRes"
"cmd": "...\\Rupelmonde.exe   -ResX=1920 -ResY=1080 -windowed -ForceRes"
"cmd": "...\\Mercator56.exe   -ResX=1080 -ResY=1920 -windowed -ForceRes"

Every landscape experience is pinned to 1920x1080. The client asked for 720p, Sunshine moved the desktop to 1280x720 as instructed, and the app window stayed 1920x1080. Capture takes the top-left 1280x720 of it and the panel upscales that. Oversized, top-left only, exactly as reported.

tickSunshineApps derives those switches from the experience's orientation, never from the resolution the client requests. The orientation contract in hydrabody's CLAUDE.md names layer 3 (app window) as hydrabody's, but layer 3 only ever tracks portrait vs landscape, not size. So layers 2 and 3 agree on shape and disagree on scale.

Why it is not seen everywhere

Any head that requests 1920x1080 is unaffected. The WebRTC default is 720p, so heads on that path hit it every time.

Notes

  • Slot 0 served this stream (PID 20684, ports 47989 / UDP 47998-48000), which has dd_configuration_option = ensure_primary. The verify_only that extra slots carry is not involved here, though it is worth checking separately whether a non-primary slot can ever adopt a requested mode.
  • chunky is on v2.0.73-rc.10 and behind the fleet: its config-slot1/sunshine.conf still writes audio_sink (the fault fixed in v2.0.75) and has no per-slot log_path, so slot 1 produces no log at all.
  • Reported back to the hydraheadandroid work in #771, whose session raised the symptom.

Session Context

Venue
mobile-kit

Comments (1)

api 18 Oct 2026 16:20

Located and confirmed in pkg/provider/experiences.go:45, streamResolution(). Two things the code adds to the diagnosis.

1. This is DRIFT, not an original design flaw, and the stale comment proves it

The function's own doc comment says:

This is the single source of truth for all three layers of the orientation contract - tickSunshineApps (layer 3) and handleStreamStarted (layer 2) both call this rather than hardcoding resolution strings.

That is no longer true. grep finds exactly ONE caller:

pkg/provider/sunshine.go:352:		_, ueArgs := streamResolution(info)

handleStreamStarted (httpserver.go:95-114) stopped calling it and now writes no resolution at all:

Layer 2 of the orientation contract: Sunshine applies the correct VDD resolution via dd_resolution_option=auto - it switches the display to match the resolution Moonlight requested [...] No config write needed here; Sunshine owns the switch.

So layer 2 was moved onto the CLIENT'S request and layer 3 was left behind on the EXPERIENCE record. The two layers agreed only while they shared an input. Nothing updated layer 3 when layer 2 changed, and nothing failed loudly, because each layer is individually self-consistent. The vddRes return value is now dead for its original purpose: only ueArgs is used.

2. The obvious fix does NOT work: there is no variable expansion

The tempting one-liner is to template the app cmd:

-ResX=%SUNSHINE_CLIENT_WIDTH% -ResY=%SUNSHINE_CLIENT_HEIGHT% -windowed -ForceRes

It would pass those strings to Unreal verbatim. From slot_files.go:274-279, already learned in this repo for the UUID case:

Sunshine runs a prep-cmd through CreateProcess rather than a shell, so only double quotes group arguments: there is no variable expansion to respect (which is why the hook reads SUNSHINE_CLIENT_UUID from its environment instead of %SUNSHINE_CLIENT_UUID%)

The values ARE available, verified against the shipped binary

Strings pulled from C:\Sunshine\sunshine.exe on chunky-turnip-23, provider 2025.924.154138:

SUNSHINE_CLIENT_WIDTH
SUNSHINE_CLIENT_HEIGHT
SUNSHINE_CLIENT_FPS
SUNSHINE_CLIENT_HDR
SUNSHINE_CLIENT_ENABLE_SOPS
...

So the requested geometry reaches a child process's ENVIRONMENT, just never its command line. hydrabody already reads exactly one of these the right way: internal/cli/stream_hook.go:48 does os.Getenv("SUNSHINE_CLIENT_UUID").

Suggested fix shape

A launcher shim, reusing the pattern already proven for the UUID. apps.json gets hydrabody.exe launch-experience --app <name> instead of the raw exe; the shim inherits SUNSHINE_CLIENT_WIDTH/HEIGHT from its environment and starts the real exe with matching -ResX/-ResY. Orientation keeps choosing which axis is long; it stops choosing the numbers.

This keeps apps.json static, so nothing has to be rewritten per session and there is no race with Sunshine parsing it.

Two constraints for whoever implements it:

  • The shim must not exit. Sunshine tracks the app process for session lifetime, so the shim has to stay as the parent and wait on the child, or Sunshine will read the stream as ended immediately.
  • Check it against the reaper. hydrabody kills any experience it sees as "orphan: no active session" within ~60s. A process tree one level deeper than today must still be recognised as Sunshine-launched.

Why this matters more with slots

The app args are a global constant while each slot's desktop is set per client. Two heads of different geometry on one body cannot both be right today, so on a multi-slot body this stops being one panel's problem and scales with the slot count. boom-pickle-38 now runs two slots and cosmic-pretzel-98 three.

The per-experience resolution override is not a workaround for this: it is per EXPERIENCE, not per head, so one experience shown on a 1920x1080 panel and a 1200x1920 tablet can only carry one number.