HydraIssues

The cluster cannot start or stop a stream on any head: both routes call the agent through ~ and the exec channel runs as root
open bug Project: hydracluster Parent: #1192 Reporter: 14 Nov 2026 21:02

Description

What happens

Both head stream verbs fail on every head, with the same error:

POST   /api/v1/heads/node-5e0ea2c8/stream
DELETE /api/v1/heads/node-5e0ea2c8/stream
-> {"error":"exec exited 127: bash: line 1: /root/.hydranode/bin/hydraheadflatscreen: No such file or directory"}

Measured on cranky-toaster-86 (node-5e0ea2c8, Omarchy) on 2026-11-14.

Why

pkg/api/handlers_head.go builds both commands with a tilde:

:592  s.execPollHead(id, "~/.hydranode/bin/hydraheadflatscreen stream-start "+req.Experience, 15)
:743  s.execPollHead(id, "~/.hydranode/bin/hydraheadflatscreen stream-stop", 15)

The exec channel runs as root, so ~ expands to /root. The agent is never installed there. recipes/hydraheadflatscreen-linux.yaml installs it under the DESKTOP user's home:

KUSER=$(loginctl list-users --no-legend | awk '$1 >= 1000 {print $2; exit}')
KHOME=$(getent passwd "$KUSER" | cut -d: -f6)
BIN_DIR="$KHOME/.hydranode/bin"

So the path is only ever correct on a head whose agent happens to live under root's home, which is no head the recipe provisions.

The fix is already on the machine

The same recipe step creates exactly what these calls need, for a different reason:

# hydranode's service version check looks in /usr/local/bin.
ln -sf "$BIN_DIR/hydraheadflatscreen" /usr/local/bin/hydraheadflatscreen

Note recipes/hydraheadflatscreen-macos.yaml creates NO such symlink, so a fix that assumes /usr/local/bin alone will work on Linux heads and keep failing on macOS ones. Resolve the binary from a candidate list instead of hardcoding one path.

Why it was not noticed

Until hydra-experiencenet v6.2.1 the kiosk did not pick up a stream it had not started itself (#1192), so this route had no observable success case on a Linux head. Fixing the kiosk made the next fault visible. The verb has presumably been broken since it was written.

Consequence, beyond the obvious

DELETE is the only supported way to stop a stream from off box. With it broken there is no way to release a lane remotely, and that compounds with two other faults found in the same run: a body whose lane outlives the stream, and an in-process stream that cannot be stopped through the head's own API. A head can be started and then cannot be stopped.

Minor, same lines

req.Experience is concatenated into the command unquoted. The route is admin-authenticated and an admin can already run arbitrary commands through the exec endpoint, so this grants nothing new, but the argument should be shell-quoted on principle.

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

Comments (1)

api 14 Nov 2026 21:14

FIXED and RELEASED as hydracluster v2.4.1. NOT yet live on the server, and not yet proven on a head.

The fix

headAgentCommand in the new pkg/api/head_agent_command.go resolves the agent at run time instead of hardcoding a path, and both call sites in handlers_head.go use it:

/usr/local/bin/hydraheadflatscreen           <- the Linux recipe guarantees this symlink
$HOME/.hydranode/bin/hydraheadflatscreen     <- a head whose agent IS in the exec user's home
/home/*/.hydranode/bin/hydraheadflatscreen   <- last guess
/Users/*/.hydranode/bin/hydraheadflatscreen

It went wider than the symlink on purpose: recipes/hydraheadflatscreen-macos.yaml creates no symlink, so fixing only /usr/local/bin would have fixed Linux heads and left macOS heads failing in the same way for the same reason.

With nothing found it exits 127 naming every path it tried. "The agent is missing" and "we looked in the wrong place" produce identical output today and are not the same fault.

Arguments are single-quoted. An admin token can already run arbitrary commands through the exec endpoint so this closes nothing that was open, but an experience name should not be able to change what runs.

Tests

Four, and two of them run the generated script under a real bash, which is the shape that would have caught this. A handler-level test never would, because the handler was correct and the string it produced was not.

  • finds and runs an agent that is NOT in the exec user's home
  • a hostile experience name arrives as ONE argument, asserted by the stand-in agent reporting $#, and a canary file proves no second command ran
  • the no-agent case exits non-zero and names where it looked
  • the command contains no tilde and does try both the Linux symlink and a macOS home

Full suite green: go build, go vet, go test ./... all pass.

Docs

The runbook was teaching this bug. It said "always use the full binary path" and then gave the ~ form as the example to copy. It now carries a table of where the agent actually lives per platform and points at headAgentCommand for new head-side calls. Testbook step 15 gains the three checks that would have caught it: run it against a REAL head, verify the stream appears with nobody touching the machine, and verify a name containing a semicolon stays one argument.

State

  • Tagged v2.4.1, release run 43641034064 succeeded.
  • releases.experiencenet.com/hydracluster/production/latest.json reports 2.4.1 and the binary serves 206 on a range request.
  • The running server is still v2.4.0. Nothing is wrong: serve.go:93 is StartAutoCheck(6*time.Hour, true) and the process has been up 14.7 hours, so the next check is roughly 3.5 hours away. No manual deploy was performed.

Still to prove

The route has not succeeded over HTTP on a head even once. When the server reports v2.4.1, re-run testbook step 10 in hydraheadflatscreen docs/testbooks/omarchy-head-e2e.md against cranky-toaster-86 with the stock agent, and both verbs should go end to end. #1192 stays open until that passes.