HydraIssues

The body debug screenshot captures the virtual desktop origin, not the streamed display
open bug Project: hydrabody Reporter: 9 Nov 2026 13:48

Description

Found by reading the code on 2026-11-09 while investigating remote capture. Not
yet reproduced on a multi display body, so treat the cosmic reasoning below as
derived rather than measured.

captureDesktop in pkg/provider/screenshot_windows.go builds the bitmap from
the primary display but copies from the virtual desktop origin:

$bitmap = New-Object System.Drawing.Bitmap(
    [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width,
    [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height)
$graphics.CopyFromScreen(0, 0, 0, 0, $bitmap.Size)

Only the size comes from PrimaryScreen. The source rectangle is
hardcoded to 0,0. Those agree only when the primary display happens to start
at the virtual origin.

On the arrangement this body had earlier today, the kiosk overlay sat on
DISPLAY1 at x = -1920 while Sunshine captured DISPLAY18 at 0,0. A capture there
takes a DISPLAY1 sized rectangle starting at 0,0, which is neither display. It
is a blind rectangle of virtual screen space.

On a single display body it is correct by accident.

Why it matters

This endpoint is the evidence used to answer "is the overlay covering the game"
and "did the experience ever draw", which is the issue 1152 class. A capture of
a rectangle nobody is streaming is evidence about the body, not proof about the
stream, and it can look perfectly healthy while the streamed display is wrong.
That is the same shape as the DISPLAY1 problem itself, which went unnoticed
because the overlay was working perfectly on a monitor nobody was watching.

What it should do

Capture the display Sunshine captures, named explicitly, rather than the
virtual origin. Sunshine's own log states the output name and the capture size,
so the body already has the answer locally.

At minimum, use the primary display's real bounds (Bounds.X, Bounds.Y)
rather than 0,0, which fixes the accidental case. Better is to select the
display by name and record which one was captured in the response, so a reader
can tell.

Related

  • #1152 overlay blocking D3D12, where this endpoint is the diagnostic
  • the cluster has no route to this endpoint at all, filed separately

Session Context

Venue
cloud-seven

Comments (2)

api 9 Nov 2026 13:53

Measured on cosmic, and the specific defect does not reproduce. The hardcoded 0,0 is correct. The concern underneath it is real and is now fixed.

THE MEASUREMENT. Four displays, one of them at x=-1920, taken from inside session 1 so the readings are real:

PrimaryScreen.Bounds = {X=0, Y=0, Width=1080, Height=1920}
PrimaryScreen.DeviceName = \.\DISPLAY18
VirtualScreen = {X=-1920, Y=0, Width=5160, Height=1920}
\.\DISPLAY1 primary=False {X=-1920,Y=0,1920x1080}
\.\DISPLAY18 primary=True {X=0,Y=0,1080x1920}
\.\DISPLAY19 primary=False {X=1080,Y=0,1080x1920}
\.\DISPLAY20 primary=False {X=2160,Y=0,1080x1920}

sampled pixel differences between CopyFromScreen(0, 0, ...) and
CopyFromScreen(Bounds.X, Bounds.Y, ...): 0

Windows defines the primary monitor's top left AS the origin of the virtual screen. PrimaryScreen.Bounds.X and .Y are therefore always 0, which the reading above confirms even with a display sitting at negative x. Passing them changes nothing. The proposed minimum fix is a no op.

THE CONTROL IS THE PART WORTH KEEPING, because without it I would have reported the opposite. My first comparison hashed the two captures and they differed, which looks like confirmation. So I ran the same capture three times with IDENTICAL arguments:

control run 1 sha256=A7E2663C...
control run 2 sha256=1F752539...
control run 3 sha256=1F752539...

Run 1 differs from runs 2 and 3 with no change in arguments at all, because the screen changes between grabs. Hash inequality says nothing about capture geometry here. The pixel comparison is what settled it.

WHAT IS ACTUALLY WRONG, which is the framing in the report rather than the line of code. This endpoint is the evidence for "is the overlay covering the game" and "did the experience ever draw", and it returned a picture of a screen with nothing saying WHICH screen. On a four display body that is not a diagnosis. It captures the primary, and on this fleet the primary IS the streamed display by construction, because hydrabody writes dd_configuration_option = ensure_primary and Sunshine makes what it captures primary at session start. That is a property of the configuration, not a guarantee of the code, and nothing made it checkable.

FIXED in hydrabody be1085e. The response now carries

X-Hydra-Captured-Display: \.\DISPLAY18 1080x1920 at 0,0 primary=True of 4

so a reader can cross check it against the output name Sunshine writes into its own log. Best effort: a missing label never fails a capture, because a picture with no label still beats no picture. The 0,0 origin now carries a comment explaining why it is correct, since the next reader will have the same entirely reasonable suspicion.

RESCOPING RATHER THAN CLOSING. The title says the capture takes a rectangle at the virtual desktop origin rather than the streamed display. The first half is wrong and the second half is the right worry. Leaving this open for the part that remains: the endpoint assumes primary equals streamed, and the body already knows the real answer locally from Sunshine's own log, so it could assert the match rather than rely on it.

One line from the report I am keeping verbatim because it is the lesson: the diagnostic had the same blind spot as the thing it was meant to diagnose. That is exactly how DISPLAY1 hid for so long, working perfectly on a monitor nobody was watching.

api 13 Nov 2026 12:19

This issue is wrong on both of its claims. I filed it, so I am recording the refutation here rather than leaving it to whoever picks it up. I recommend closing it.

Claim one, the capture origin: refuted by measurement

I wrote that the helper captures a rectangle at the virtual desktop origin instead of the streamed display. I derived that from reading CopyFromScreen(0, 0, ...) and I flagged at the time that it was not measured. A peer then measured it.

Windows defines the primary monitor top left AS the virtual screen origin. PrimaryScreen.Bounds.X and .Y are always 0, even with a second display at x=-1920. So the literal (0, 0) source is the primary monitor top left, not some other screen. The helper captures the primary monitor, which is what it intends to do.

Claim two, primary is not the streamed display: answered by #428

After the first refutation I fell back to a narrower worry: the helper takes the PRIMARY monitor, and on a body with a virtual display driver the STREAMED display might not be primary. That worry is much weaker than I thought, and #428 already settled it in August.

#428 investigated cosmic-pretzel-98 while it had THREE Virtual Display Driver adapter instances plus a physical monitor, an extended desktop across four displays. That is the worst case this worry imagines. It found:

Sunshine captures {5eb52002-...} and makes it primary, which is why video is correct (verified: hydrabody debug screenshot during a live stream returns a 1920x1080 image of the castle).

So the two do not merely happen to coincide. Sunshine makes its captured display the primary one. And that was verified using this exact endpoint, during a live stream, on the most adversarial display topology in the fleet.

A second, independent confirmation arrived on 2026-11-13: a capture from cosmic over WireGuard returned a valid 1080 x 1920 portrait JPEG showing the real composited desktop with the experiencenet idle overlay. Streamed content, correct orientation, not a stub.

What is actually true

The capture path works and returns the streamed display. There is no rectangle bug.

The real defect in this area is #428, which is still open: duplicate VDD adapter instances break ABSOLUTE MOUSE MAPPING, because Moonlight normalises absolute coordinates against a virtual desktop that now spans several monitors. Video is perfect and nothing is clickable. #428 carries the fix and an un-actioned step four, audit the other bodies for the same condition.

That step four has now found a second machine. zappy-cactus-6 shows two VDD instances, ROOT\DISPLAY\0000 in Error and ROOT\DISPLAY\0001 OK, and it is about to take the hydrabody role.

Consequence for #1161

#1161 says to ship the proxy route together with this issue. That dependency is void. #1161 can proceed on its own.

Nothing here blocks the route, and the "confident picture of the wrong screen" risk I used to justify the pairing does not exist.