Repository navigation
feat(amd): Sunshine+Moonlight primary desktop, Helium CDP, encoder watchdog (#5924) - #6088
Conversation
…tchdog (#5924) Implements the GUI-access verdict of #5924 for host amd: - nixos/hosts/amd-sunshine.nix (new): services.sunshine as a user service, KMS capture for the Hyprland/wlroots session, encoder preference-pinned to VAAPI (Radeon 780M; vainfo-verified H.264+HEVC EncSlice), openFirewall=false so it is reachable over the trusted tailscale0 interface only. Moonlight-Qt installed as the client. - The pin alone cannot guarantee hardware encoding: in the pinned Sunshine source (src/video.cpp probe_encoders) a rejected encoder is logged and the probe falls through to software. So the module also ships sunshine-encoder-check — a user oneshot + hourly timer that FAILS into `systemctl --user --failed` when this boot's journal shows the pin rejected, no working encoder, or a software winner ("Found H.264 encoder: ... [software]" / "Creating encoder [software]"), and passes only on VAAPI evidence. Verdict logic tested against synthetic journals for all four cases. - nixos/environment/default.nix: scaleElectron2x generalized to wrapElectronWithFlags (existing apps unchanged); Helium now also carries --remote-debugging-address=127.0.0.1 --remote-debugging-port=19222 on every launch path, so CDP survives restarts/logins. The tailnet path is a `tailscale serve` mapping made at activation (fleet convention: serve state is imperative). - doc/2026-11-04_remote-gui-access-runbook.md: decision table (Sunshine primary / RustDesk fallback / CRD break-glass / agent hierarchy API > CDP > AT-SPI > stills), fleet-proxy verdicts per path (streaming stays tailnet-direct UDP; CDP rides the CONNECT proxy; broker carries no streams), activation checklist, and the blocker taxonomy (real vs not-a-blocker). Verified: full config eval; sunshine.conf renders capture=kms + encoder=vaapi; checker and Helium CDP wrapper derivations build (the wrapper execs helium with all three flags; desktop entries repointed); CDP smoke test from the sandbox through the runtime CONNECT proxy (:3130) to a throwaway Helium on a scratch port via a temporary serve mapping — /json/version, /json/list, and a WebSocket Runtime.evaluate all passed; scaffolding removed afterwards. Activation (switch + serve mapping + pairing + the in-session encoder spike) is staged for when the desktop session is free; the runbook §5 is the checklist.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efeb71a1c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| systemd.user.timers.sunshine-encoder-check = { | ||
| Unit.Description = "Hourly Sunshine encoder check (code#5924)"; | ||
| Timer = { | ||
| OnBootSec = "10min"; | ||
| OnUnitActiveSec = "1h"; |
There was a problem hiding this comment.
Register the new Sunshine watchdog schedule
This enables a laptop systemd timer running ten minutes after boot and hourly thereafter, but doc/fleet-schedule-registry.md is unchanged and contains no Sunshine entry (checked with git grep -n -i sunshine 3f4c454f -- doc/fleet-schedule-registry.md). The scheduled workload will therefore be invisible to the fleet placement audit. Add the timer to Surface 2b with its cadence and service pointer in the same change, as required by the root AGENTS.md fleet-schedule rule.
AGENTS.md reference: AGENTS.md:L53-L58
Useful? React with 👍 / 👎.
…de#5924) CDP-everywhere audit follow-up to PR #6088 (Helium): the other Chromium-family browsers in the shared desktop config were installed raw, so their DevTools endpoint existed only when a caller passed flags itself. Fleet port convention: 19222 Helium, 19223 Brave, 19224 Chromium, all bound to 127.0.0.1 only (remote path stays loopback + tailscale serve / CONNECT proxy per doc/2026-11-04_remote-gui-access-runbook.md). Chromium gets a bin-only wrapper (its desktop file uses a bare Exec=chromium resolved via PATH; wrapElectronWithFlags cannot be reused because the package symlinks share/applications into chromium-unwrapped and the helper desktop rewrite fails on the read-only target). Brave gets the full wrapper treatment in home/common (binaries wrapped, desktop entries repointed). Wrapper flags precede caller args, so playwright/puppeteer callers passing their own --remote-debugging-port still win. Firefox and Zen (Firefox-family) have no CDP; their remote protocol is WebDriver BiDi, left unconfigured and documented as a gap on #5924. Verified: both new derivations built and inspected (flags present; Brave desktop Exec repointed); changed modules evaluate for hosts amd and nixos. No switch performed -- activation rides the next system switch.
Implements the GUI-access verdict in #5924 for host
amd. Runbook:doc/2026-11-04_remote-gui-access-runbook.md(decision table, per-path proxy verdicts, activation checklist, blocker taxonomy).What changed
nixos/hosts/amd-sunshine.nix(new) —services.sunshineas a user service chained to the graphical session:capture = "kms"(the path that works under this host's Hyprland/wlroots session),encoder = "vaapi"(Radeon 780M iGPU;vainfoon the machine confirms VAAPI H.264 + HEVC EncSlice),capSysAdmin = true,openFirewall = false— reachable via the trustedtailscale0interface only, never opened to the LAN. Moonlight-Qt added as the client package.The encoder alarm — the config pin is only a preference: in the pinned Sunshine source (
src/video.cpp,probe_encoders), a rejected encoder logsCouldn't find any working encoder matching [vaapi]and the probe falls through to software. So the module shipssunshine-encoder-check: a user oneshot + hourly timer that fails intosystemctl --user --failedon a rejected pin, no working encoder, or a software winner (Found H.264 encoder: … [software]/Creating encoder [software]), and passes only on VAAPI evidence. Log patterns were matched against the pinned source's actual strings, and the verdict logic was exercised against synthetic journals for all four cases (vaapi OK / software FAIL / pin-rejected FAIL / no-evidence inconclusive).nixos/environment/default.nix—scaleElectron2xgeneralized towrapElectronWithFlags(existing apps' derivations unchanged). Helium now carries--remote-debugging-address=127.0.0.1 --remote-debugging-port=19222on every launch path (bin wrapper + repointed desktop entries). Before this, the installed Helium exposed no CDP port at all. Note: this module is shared — hostnixosgets the same CDP-on-loopback Helium. The tailnet path is atailscale servemapping created at activation (fleet convention: serve state is imperative, never declared).Verification
sunshine.conf=capture=kms,encoder=vaapi,port=47989.tailscale servemapping → throwaway Helium on scratch port 19223):/json/version✓,/json/list✓, WebSocketRuntime.evaluate("1+1") → 2✓. All scaffolding removed afterwards; the live desktop browser was not touched.Activation is staged, deliberately
No switch was run: the laptop desktop session is actively in use, and a switch can restart it. Merging ≠ switching. When the desktop is free and no switch is running, runbook §5 is the ordered checklist (switch → serve mapping for 19222 → Helium relaunch → web-UI credentials → Moonlight pairing →
sunshine-encoder-checkduring a real stream — the #5924 spike criterion). Post-activation items that are intentionally NOT in this PR: Sunshine web-UI credentials and Moonlight pairing state (imperative, under~/.config/sunshine, never in the repo).Fleet-proxy study (in the runbook, §4)
Streaming stays tailnet-direct (UDP; a TCP CONNECT proxy cannot carry it and WireGuard already does it better). CDP rides the CONNECT proxy + serve (proven above). RustDesk stays on its dedicated SSH forward until the #5694 splice is built; the broker protocol is request/response-shaped and carries no byte streams. SSH stays on
laptop-ssh.sh. No live routing was changed.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.