Skip to content

Operate live review sessions

A live review session is one Neko browser in one container, opened by a reviewer (a member or a share guest) to comment on one live document. It costs 4 GiB of memory, holds a person’s signed-in browser, and must end by itself when nobody is looking.

Live comment mode is a product feature, not a deployment fragment. The product creates and owns every piece a session needs: the dedicated network, the relay, the session containers, the TURN listener, and both shared secrets. The TURN listener is in the supacloud-server process (turn-rs) on one port, 3478 UDP and TCP; the browser reaches it at the hub’s own public origin, and the review runner reaches it through the relay’s forwarder. Signalling and DevTools ride the existing hub WebSocket and the runner gRPC tunnel. A deployment sets nothing for live mode: no TURN host, no DNS record, no certificate, no firewall handoff and no compose fragment.

Live mode asks a deployment for nothing. SupaCloud uses the public host it already runs: the hub’s own public origin (PUBLIC_URL) and the DNS name that origin already resolves. The hub serves TURN itself inside the supacloud-server process on 3478/udp and 3478/tcp (turn-rs); the product generates the TURN secret, the live network, the relay and the session containers. There is no coturn container, no second host, no certificate export and no firewall handoff to anybody outside SupaCloud.

The listener itself starts when SUPACLOUD_LIVE_TURN_LISTEN names its bind (for example 0.0.0.0:3478) and stays off in a process that does not set it; the address it advertises is derived from the PUBLIC_URL host at boot, and SUPACLOUD_LIVE_TURN_EXTERNAL exists only to override that choice when the hub’s own name resolves to a private address, or to several public addresses (the hub then refuses to guess which one a browser reaches). 3478/udp and 3478/tcp are the only ports involved: relay ports are virtual on the one server and are never published.

The review runner (for example sc-worker-01) keeps its shape: internet egress only, no public address, no inbound port. Its session reaches the hub’s TURN listener through the relay’s TURN forwarder on the runner’s existing outbound path; the reviewer’s browser reaches the hub’s public origin on 3478. Nothing on the review runner is exposed.

The media and control paths. The browser’s WebRTC media uses the hub’s TURN listener; its signalling and the DevTools channel ride the existing hub WebSocket and the runner gRPC tunnel. The session container never reaches a hub listener, the browser never reaches the runner, and every TURN credential is per session.

Every object below is created by the product and labelled managed_by=supacloud. A container or network of the product’s name that does not carry the product’s shape is never adopted, mutated or deleted; it is reported and live sessions stay unavailable.

Object Where What exactly State on 2026-11-17
Live network Session host (the hub itself under the hub placement) supacloud-live, an internal IPv4 bridge on 172.30.0.0/24 (or SUPACLOUD_LIVE_SUBNET), labelled managed_by=supacloud, no driver options. Created once, then verified. Built for the hub; being built for a runner.
Relay Session host supacloud-live-relay, a container of the release image running the live_relay bin: proxy listener on the live network at 172.30.0.2:3128, signalling/control listener on the deployment network under the relay’s own name, and the TURN forwarder that carries the session’s TURN traffic to the hub’s in-process TURN listener. Reconciled, never blindly recreated. Built for the hub (proxy and signalling); the TURN forwarder is being built.
Session containers Session host One supacloud-live-<session id> container per open session at its assigned live-network address, 4 GiB, 2 CPUs, all capabilities dropped, no published port, no bind, read-only root with tmpfs home and /tmp. Built for the hub; being built for a runner.
TURN listener The supacloud-server process turn-rs inside the hub process, on one port: 3478/udp and 3478/tcp. The browser reaches it at the hub’s public origin; the review runner reaches it through the relay’s forwarder. No coturn container, no second host and no Docker-published port are involved. Being built.
TURN secret The hub generates and holds it 32 random bytes, generated once per instance when neither the environment nor the OpenBao supacloud/app map supplies a value, stored AES-256-GCM-encrypted under the credential-encryption key (the same envelope as the relay secret) and read back on every boot. The in-process TURN listener uses it to validate the per-session credentials; it never enters a session container, the review runner or the browser. Being built (the secret tier is committed; the listener is a separate slice).
Relay secret Hub and session host 32 random bytes, generated once per instance under the same rules; it signs the browser ticket and authenticates the hub to the relay. Built.
Live-session image Session host The derived Neko image, built from docker/live-session/Dockerfile, published by CI under the commit tag and resolved by digest from the release. Built.

The subnet is fixed so the product and its guard derive the same addresses:

Address Owner
network + 1 (.1) Docker’s gateway. Never a session.
network + 2 (.2) The relay: the proxy listener, the TURN forwarder, and the proxy every session names. Never a session.
network + 3 … broadcast - 1 Session addresses, assigned by the hub from the session’s deployment-wide slot ordinal before the container is created.

The hub assigns the address and registers it with the relay before the container is created, so a dead container’s freed address can never serve the next session’s browser. The guard admits a static address only inside that session range, only for a live-session container, only on the live network, and refuses every other static-address field.

The dedicated network is created once and then only verified. A network of that name that is not the product’s own — no managed_by=supacloud label, not internal, or on another subnet — is never adopted or mutated: the boot line says why it is unusable and opens refuse.

The session itself has two placements; the TURN listener is part of the hub process, not a container or a runner role:

Role Selected by What it creates
Session runner capabilities.live_session=true and SUPACLOUD_RUNNER_JOBS containing live_session; the review host with no public address the live network, the relay, and one container per session, through its own guard
Hub placement SUPACLOUD_DOCKER=on the same network, relay and session container on the hub itself
In-process TURN listener the supacloud-server process, always turn-rs on one port, 3478/udp and 3478/tcp. No container, no Docker guard, no certificate and no deployment setting are involved

There is no silent fallback: a fleet-placed open with no eligible session runner refuses with no_eligible_runner and creates nothing; an open with no usable TURN listener refuses with live_media_not_configured. The sentence names which side is missing.

The session runner is outbound-only. The browser’s signalling socket arrives at the hub and rides the existing hub WebSocket; the relay’s signalling and DevTools channel ride the runner gRPC tunnel. The forward proxy, the DevTools tunnel and every media packet stay on the session’s host; the session’s TURN traffic leaves through the relay’s TURN forwarder to the hub’s in-process listener (see TURN: hub listener, per-session credentials).

A runner that offers live sessions needs everything below. Nothing here is optional, and the hub reads capability and grant, never a container label.

Runner setting Value Why
SUPACLOUD_RUNNER_JOBS live_session (plus any other kinds the runner serves) the job loop it runs; an unknown word is a hard config error
runners.capabilities.live_session true, set on the runner row by the operator or the management API both the hub’s claim predicate and its no_eligible_runner sentence read this JSON flag. A Docker label on the runner container is not consulted
grant non-marketplace, tier docker or both, class trusted, covering the workspace (or trusted-wildcard). A live session is refused for an edge grant the same grant rule every docker-tier runner job takes
DOCKER_HOST the runner’s own daemon, reached through the product’s Docker guard the session container, network and relay are created on the host that carries them, and the guard admits exactly their shapes
Docker guard live policy the same release that runs the runner: live image digest, supacloud-live, the subnet, the relay control network and the session ceilings a runner whose guard names another image or subnet cannot create the session the hub assigned

The session runner needs no public address, no inbound port and no TURN setting. Its containers publish nothing and reach the internet only through the relay.

The hub serves TURN itself inside the supacloud-server process (turn-rs). It needs no runner role, no container, no Docker guard and no deployment setting:

  • one listener on 3478/udp and 3478/tcp; the browser reaches it at the hub’s existing public origin (PUBLIC_URL), and the review runner reaches it through the relay’s forwarder on the runner’s existing outbound path;
  • the instance TURN secret is generated by the hub and used by the listener to validate the per-session credentials; it is never written to a job row, a log line, the review runner or a session container;
  • the session’s ICE list is the hub host on 3478 for both transports; no turns: listener and no certificate are involved;
  • a listener that cannot start reports the reason and opens refuse with live_media_not_configured; it never starts a half-configured TURN path.

TURN: hub listener, per-session credentials

Section titled “TURN: hub listener, per-session credentials”

TURN must be reachable from the public internet, and it runs in the hub process on 3478 because the review host has no public address. Reviewers are not only members on the company network: a share-link guest and an external project participant open the same session over the same media path, and a TURN listener reachable only from an internal network leaves them with “The video connection failed.” while every server-side check has already passed.

Both ends of the call allocate on the hub’s TURN listener:

  • the reviewer’s browser allocates a relay candidate on the hub’s TURN listener and is configured relay-only, so it never offers a host or server-reflexive candidate;
  • the session’s Neko receives the hub host’s TURN URLs and its own per-session credential through NEKO_ICESERVERS and allocates a relay candidate outbound;
  • the selected pair is therefore the browser’s relay allocation against the session’s relay allocation on the hub’s listener, and no packet is ever sent to the session host from outside.

The session’s TURN traffic cannot use the live network’s internet path, because that network is internal and the session publishes nothing. The relay carries it: its live-network endpoint also answers the hub’s TURN name (Docker’s embedded DNS resolves that name to 172.30.0.2 inside the live network), and its TURN forwarder sends the session’s TURN messages to the hub’s listener over the relay’s own egress leg and returns the answers. The upstream is fixed at the hub’s PUBLIC_URL host and port 3478; the forwarder is not a general UDP proxy.

turn-rs runs inside the supacloud-server process and listens on one port, 3478/udp and 3478/tcp. No container, no Docker guard rule, no published port and no certificate take part. The relayed candidate it hands out is the hub’s own public address, so a browser on the public internet reaches exactly the service that already answers the hub’s public origin.

Reachability does not mean an open relay:

  • every credential is minted per session from the instance TURN secret (TURN REST) and expires with the session, so an allocation without a current credential is refused;
  • both ends are configured relay-only, so the intended peer of a session’s allocation is the other allocation of the same session;
  • TURN’s protocol still lets a credentialed client ask the listener to reach another address. The listener is therefore an SSRF surface like any TURN server, and its peer policy (never the live network, the session host, the platform or cloud-metadata addresses) is part of the listener integration that is being built — it is not a property of the port being open;
  • the listener shares the hub’s resource envelope and is not separately exposed: it adds no process, no container and no second host to a deployment.

The session’s ICE list is the hub host on 3478 for both transports: turn:<name>:3478?transport=udp and turn:<name>:3478?transport=tcp, derived from PUBLIC_URL (sc_config::live_turn_urls). No turns: listener exists, because signalling and DevTools do not use TURN at all. SUPACLOUD_LIVE_TURN_URLS stays an override for a deployment that fronts its own TURN server; when it is set, the configured secret must be that server’s and the in-process listener is not used.

Variable Default Floor Effect
SUPACLOUD_LIVE_SESSION_IDLE_SECONDS 600 60 Seconds without input before the session ends with reason idle.
SUPACLOUD_LIVE_SESSION_ABSOLUTE_SECONDS 3600 120 Seconds after creation before the session ends with reason absolute, whatever the input.

The absolute deadline must be greater than the idle deadline. A pair that breaks a floor or that order is refused as a pair: the broker logs live session limits are invalid (idle >= 60, absolute >= 120 and > idle) and runs the built-in 600/3600 instead of starting with a limit nobody can work under.

The deadline is enforced by the leased sweep, which runs once a minute and compares every open session against both bounds. The sweep is also the backstop for a session whose reviewer closed the tab: no browser message is needed for a session to end. The container is stopped after the end is recorded, and a failed stop stays owed until a later sweep succeeds — the sweep is the only path that reclaims a container nobody is using.

Three bounds block an open with a 429 and a named code, all admitted under transactional advisory locks so two parallel opens cannot both pass the count:

Variable Default Refusal code Bounds
SUPACLOUD_LIVE_SESSION_WORKSPACE_MAX 4 live_session_capacity Open sessions in one workspace.
SUPACLOUD_LIVE_SESSION_INSTANCE_MAX 8 live_session_capacity Open sessions on the whole instance. It also sizes the live subnet: the deployment must carry this many session addresses plus the gateway and the relay.
SUPACLOUD_LIVE_SESSION_SHARE_ANONYMOUS_MAX 2 live_session_capacity Open anonymous sessions on one share, because a public link mints a new holder secret on every open. A signed-in member is not affected.

The instance capacity is carried by the hub’s own TURN listener: one listener relays every open session of the instance, so a second TURN listener is a separate selection, not a second pool behind one name.

Two further bounds are rolling quotas, not counts of open rows. Both are read once at broker construction and both refuse with a 429.

Sessions started — SUPACLOUD_LIVE_SESSION_PROJECT_SESSIONS_24H (default 20), the live sessions ONE project may start in a rolling 24-hour window. A start past it is refused with live_session_quota: this project holds 20 of 20 live sessions in the last 24 h.

  • The session row carries no project id, so the broker counts through the document’s project. A document with no project counts toward no project and is bounded only by the workspace and instance caps.
  • Ended sessions count. The quota is about how often a project may start a browser, not how many are running, so a project cannot cycle sessions through the instance capacity.
  • A start that fails counts too (start_failed): an abandoned container is still a start, so a runtime that keeps failing exhausts the window and the next reviewer sees live_session_quota rather than an error from the browser. Check the runtime’s own refusals first when a project’s quota runs out without any page being reviewed.
  • A value below 1 is an operator error, not a lockdown: the broker logs it and uses the built-in 20. Raise the value when a project legitimately reviews more than 20 pages a day; lowering it below the day’s current count refuses every new session of that project until the window rolls past the excess.

Evidence bytes — SUPACLOUD_LIVE_SESSION_PROJECT_EVIDENCE_BYTES (default 268435456, 256 MiB), the stored live_evidence bytes ONE project may hold in the rolling 30-day evidence window. A start past it is refused with live_evidence_quota: this project holds 272629760 of 268435456 live evidence bytes in the last 30 days.

  • The count is the stored size of the project’s live_evidence screenshots, read from the artifacts the project owns: the ingest stamps each one with the project of the document it was captured on, so a failure screenshot that no comment ever carries counts like an attached one, and each artifact counts once.
  • The window filters on the artifact’s own age, because that is the clock its 30-day live_evidence retention expires on: bytes leave the count as the hourly artifact sweep retires them, nothing is credited early and no second ledger can drift from the store.
  • A value below 1048576 (1 MiB) is an operator error, not a lockdown: the broker logs it and uses the built-in 256 MiB. When a project does reach the bound, evidence is refused visibly rather than dropped quietly — the reviewer sees live_evidence_quota and can lower the stored size by attaching fewer screenshots, or wait for the window to roll.

Every refusal above reaches the reviewer as a live comment-mode error; nothing is created, no container starts, and no capacity is reserved.

When the browser cannot receive the stream, the viewer shows “The video connection failed.” (live_viewer_error_webrtc) and offers a retry, which mints a fresh ticket and offers the stream again. This failure is never about the page being reviewed: the ticket, the relay socket and the document checks have already passed at that point, so the cause lies between the browser and the TURN server. Check, in this order:

  1. The hub’s public origin. The host in PUBLIC_URL must resolve to the hub’s public address and the deployment’s firewall must carry 3478/udp and 3478/tcp on that name. 443 belongs to the hub’s HTTPS front door and is not a TURN listener, so a guest network that allows only outbound 443 cannot stream. This is a known limit, not a misconfiguration to hunt.
  2. The TURN secret. It is generated once per instance when nothing overrides it and is used only by the in-process listener. Without a credential-encryption key the product refuses to generate one (an explicit environment or vault value still works) and every open refuses with live_media_not_configured; an open that succeeded had a usable secret at that moment. Read turn_secret_source in the boot line: environment or vault means an override, and instance means the product generated it.
  3. The TURN listener. It is part of the supacloud-server process; a listener that failed to start, or one whose advertised address is not the hub’s public address, refuses the media path while the session itself is open. The boot line names turn_enabled and the derived URLs, so a listener that is not listening is visible there.
  4. The relay’s TURN forwarder. The session reaches the hub’s listener only through the relay, and the relay’s live-network endpoint answers the hub’s TURN name. A relay that is down or a forwarder whose upstream is not the hub’s PUBLIC_URL host ends the media path even though the browser can reach the listener directly.
  5. The relay. Its URL is the relay’s name on the deployment network and its secret is generated on first boot (or set by the deployment), so the boot line reports both a relay_url value and a relay_secret_source; every open refuses with live_relay_not_configured before a ticket exists only when that source is none — which means the deployment set a value that is unusable (a secret under 32 bytes) or this host has no credential-encryption key.

Every other failure kind is reported before any media is offered and names its own cause: missing_session, connect_refused, not_live, not_ready, socket and protocol. Only connect_refused, not_ready, socket and web_rtc are retryable; a missing session, a document that is no longer live and an unexpected protocol answer are not, and retrying them only loops.

A live session that had started and then fails (its container or browser died under the reviewer, which the sweep records as container_gone) leaves ONE masked picture of the session browser. The operator contract is:

  • When. Only the container_gone end takes one. A start that never answered ready (start_failed), a deadline, the reviewer’s own end and a revoked share leave none, and a session takes at most one capture ever: the claim is a conditional write on the session row, so two hub replicas that both notice the dead container cannot both capture, and a retried sweep tick cannot capture twice.
  • How. The broker photographs the session’s own browser through the DevTools channel the comment mode already uses (the relay dial, or the parked runner tunnel on a fleet placement), clipped to the visible viewport at CSS scale 1, and masks it with the same opaque #000000 fill the reviewer’s own mask editor paints. One DOM walk decides what is painted — it reads the page’s light DOM, its open shadow roots and every same-process frame — and it covers exactly these rectangles, nothing less:
    • every text-entry field: an input of every type this product does not classify as a non-entry control (buttons, checkboxes, radios, ranges, colour pickers, file, image and hidden inputs are the exceptions) — a missing, empty or unrecognised type counts as text, so a bare <input> is masked — every textarea, and every element whose contenteditable is anything but false ("", true, plaintext-only and any value a page invents are all masked);
    • every iframe, frame, embed and object whole: a cross-origin frame’s document (a payment provider’s card fields, an IdP login) is never reachable from the hub, so its rectangle is the only honest mask, and nothing inside it is walked;
    • the whole box of a host of a closed shadow root (shadowRootType: "closed", which the pierced DOM reports — it is what DevTools renders as #shadow-root (closed)): what a closed root holds is not something this walk relies on, so the host is painted instead of its content. An open shadow root is walked, so its fields are masked individually and its host keeps its pixels. A user-agent root — the browser’s own rendering inside input, video, details, meter, progress — is neither masked nor walked: the element is judged by its own tag, so a native text field is still masked as a field. Nothing is masked for being empty: an empty div, span, icon or skeleton keeps its pixels, so a real page does not exhaust the mask. Prose, tables and images are never masked. A page the walk cannot enumerate in full (more than 20 000 nodes) or one that needs more than 128 masks is refused (unmaskable) rather than stored half-masked — and so is a picture whose pixel scale does not match the clip.
  • Where it is stored. Through the one live-evidence writer, without a holder: it is a live_evidence artifact of the document’s project, retained 30 days and swept by the hourly artifact sweep like every other evidence attachment. It is never bindable to a comment.
  • What it costs. The capture is charged to the project’s rolling live-evidence byte bound (SUPACLOUD_LIVE_SESSION_PROJECT_EVIDENCE_BYTES) before the browser is asked for a picture; a project already at its bound gets no capture.
  • What the record says. The session’s artifact_live_session.ended audit row carries failure_screenshot: {"status": "stored", "artifact_id": …} or {"status": "skipped", "reason": …} with one word — not_started, devtools_unavailable, live_evidence_quota, already_attempted, unmaskable, too_large, capture_failed, timeout or store_refused. Every other end’s payload carries no failure_screenshot key at all.
  • What a failed capture never does. It never changes the end reason and never fails the end: a container that is gone usually means a browser that cannot answer, so the attempt is bounded (8 s, inside one sweep round) and its refusal is logged with the session id and recorded as the named skip above.

The broker logs one line at construction:

live sessions: deadlines, capacity, quota, media, relay and container runtime

It names idle_seconds, absolute_seconds, workspace_max, instance_max, share_anonymous_max, project_sessions_24h, whether TURN and the relay are enabled, the live subnet, and whether a container runtime is wired. Since the product supplies the live defaults it also names where each secret came from (turn_secret_source, relay_secret_source: environment, vault, instance or none) and the relay URL it will dial — a value, not a secret, so a wrong derivation is visible instead of inferred. A second line states the quotas on their own (live session quotas in force: project_sessions_24h=20 project_evidence_bytes_30d=268435456) because they have their own variables. Read those lines before you believe any other diagnosis: a limit that is not in the boot line is not in force.

A live-capable session runner logs its own host line when it reconciles: the live network and its outcome (created or verified), the relay outcome, the live subnet, and whether the TURN forwarder has an upstream. The hub logs its live-media line: whether the in-process listener started (turn_enabled), the derived TURN URLs (values, not secrets) and turn_secret_source. Neither logs a secret.