HydraIssues

A body's lane outlives the stream: stream_count stays 1 after CLIENT DISCONNECTED, so the next head is told no body has the experience
open bug Project: hydrabody Parent: #1192 Reporter: 14 Nov 2026 21:02

Description

What happens

After a stream ended cleanly on the body (CLIENT DISCONNECTED in the Sunshine log at 20:57), hydracluster's /bodies/eligible still reported the lane as occupied:

stream_count=1  free_slots=0

The next discovery therefore failed with:

no reachable bodies found ... with experience installed

Restarting hydrabody cleared it to stream_count=0 free_slots=1 and discovery succeeded immediately.

Measured 2026-11-14 on the omarchy-body cloud body (GCP L4, mesh 10.10.100.29) with cranky-toaster-86 as the head.

Why this is worse than a stale counter

The error message names the experience and the catalog, so it reads as "this body does not have the game installed". The body has the game installed. It has no free lane. Those are different faults with different fixes, and the message sends you to the wrong one. A session will go and check the catalog, the exe path, the platform skip rule and the library sync before suspecting a counter.

Why it matters now rather than later

It compounds with two faults found in the same run:

  • hydracluster's DELETE /api/v1/heads/{id}/stream is broken (#1193), so the lane cannot be released from off box.
  • An in-process stream cannot be stopped through the head's own API either.

So a stuck lane currently has no remote remedy at all. The documented recovery is restarting hydrabody, which is a body-side service restart for what began as a head-side stream ending normally.

Worth separating in the fix

Two things could be wrong and they want different answers: the body's own notion of an active stream outliving the Sunshine session, or the cluster caching the body's last report. The measurement above points at the body, since restarting hydrabody is what cleared it, but that should be confirmed rather than assumed.

Found by a peer session while running testbook step 10 for #1192.

Comments (2)

api 15 Nov 2026 07:44

Both halves fixed. The report asked for the two to be separated rather than assumed, so here is what the evidence settles and what it does not.

Which half was wrong: the body, confirmed from the measurement in the report. Restarting hydrabody cleared it. The startup recovery reads Sunshine's currentgame and rebuilds a session from it; after the restart it rebuilt nothing, so Sunshine was already idle at that moment. The lane was held by state in the hydrabody process and nowhere else. The cluster was not caching anything.

Why it was never released. A session ends because the prep-cmd Undo hook arrives at /api/v1/stream/ended. That one message is the only thing that frees a lane, and nothing checked it. The observation that would have settled it was made exactly once, at startup.

hydrabody v2.1.6: reconcileSessionsWithSunshine now makes that same observation on every tick and ends any active session Sunshine has no running app for. Sunshine is the authority on whether the body is occupied; the hook is only the fast path. The session then travels the ordinary disconnected path, so grace, expiry and the orphan kill are unchanged.

Three guards, each for a reason:

Guard Why
2 consecutive idle readings Sunshine runs the Do prep-cmd BEFORE it launches the app, so a starting stream reads as idle for a moment
session at least 45 s old the same launch window, from the other side
a read error is never idle a Sunshine that does not answer has worse problems than a counter, and ending live sessions is the wrong direction

The tick runs every 5 s while the provider reports streaming, so a phantom lane comes back in about ten seconds rather than never. Multi-slot bodies do not use this path: their count comes from the per-slot observation and the whole provider tick is skipped there.

What it does NOT do: it does not find out why the hook was missed. The log says which pass happened, and that distinction is in the testbook as a pass criterion rather than a footnote:

  • [sunshine] stream ended: <app> means the hook arrived and the reconcile was never needed. Healthy.
  • [sunshine] session ... has no running app in Sunshine ... (issue #1194) means the hook was MISSED. The lane is correct and the Undo prep-cmd is broken on that body. File it separately rather than closing it as a pass.

hydraheadflatscreen v2.9.1 (merging): the message. The report is right that this was worse than the counter. A full body was passed over in silence and the failure read "no reachable bodies found ... with experience installed", which names the experience and the catalog. Every body in the eligible list already HAS the experience, because the cluster matched it. The failure now lists each body and the reason:

no body in district bxl1-test-2 could take this stream for "world-of-warcraft-linux".
Every eligible body has the experience; each was passed over:
omarchy-body (no free lane, 1 streaming)

no free lane, N streaming points here. unreachable on every transport points at the mesh. unusable stream port N points at the slot configuration. The one message that still points at the catalog is the one that should: an empty eligible list.

Not verified on a device. Seven hydrabody tests drive the real Tick(), and the first one fails with the reconcile call removed, so they measure the fix rather than agree with it. But omarchy-body is offline (GCP), so nothing has been measured on the machine where this was found. docs/testbooks/stream-watchdogs.md test 6 is the gate, and it says how to tell the healthy pass from the one that hides a broken hook.

api 18 Nov 2026 03:08

Fleet state, read live on 2026-11-18. The fix is deployed, and not to anything it can be tested on.

Where v2.1.6 runs: cosmic-pretzel-98 (bxl1-mercator-39, cloud-seven) and boom-pickle-38 (bxl1-mercator-37, rupelmonde). Both are production venues, so neither is a legitimate test target.

What the test districts hold: wobbly-llama-92 offline on v2.0.90, spicy-cactus-76 on v2.0.91-rc.1, cloud-l4-euw1 offline on v2.0.73. No body in a test district carries the reconcile.

The body this was found on is gone. It is not offline, it is no longer enrolled in the cluster.

So test 6 stays unrun, and the two paths to running it are to update a test-district body to v2.1.6, or to bring a cloud body back into bxl1-test-2, which also unblocks the stop gate on issue #1195.

One precondition added to test 6. The reconcile cannot run on a multi-slot body: provider.go ticks the stream provider only while slot control is off, and a multi-slot lane count comes from the per-slot observation instead. Test 6 now says to use a single-slot body, because the likeliest test bodies in the fleet today are slot bodies and a reading from one means nothing in either direction.