Skip to content

feat(net): remote viewers keep their speed on lossy, long links - #3280

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
darthShadow:feat/tcp-congestion-bbr
Oct 30, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
darthShadow:feat/tcp-congestion-bbr

Conversation

@darthShadow

@darthShadow darthShadow commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Remote viewers can get far less throughput than their connection supports when packets are lost or round trips are long. This change requests kernel BBR on Silo's client listeners and lifts small server send-buffer limits where permitted.

Related issue: N/A
Validation tasks: changes #1177 C1, C2

Approach

The native API, Jellyfin, Audiobookshelf, and standalone proxy listeners use the same socket policy. Client-visible API contracts do not change. Apple and Android need no client changes; jellycompat receives the same tuning without a protocol change. Transcode, metrics, and debug listeners keep their socket settings.

Each node reads two independent settings at startup:

  • SILO_NET_TCP_CONGESTION: bbr by default; off keeps the kernel's controller.
  • SILO_NET_TCP_SEND_BUFFER: a positive decimal byte size up to 1073741823, default 33554432 (32 MiB); off keeps send-buffer autotuning. An unrecognized value, such as false or 0, turns that setting off and logs a warning.

Silo forces the configured send buffer only when the readable kernel send maximum is below 25000000 bytes, the doubled request exceeds that maximum, and the NET_ADMIN helper is running. Linux doubles the default request to 67108864 bytes (64 MiB). Otherwise Silo keeps autotuning. Every Linux client listener also sets TCP_NOTSENT_LOWAT=131072 (128 KiB), including with either setting off or without NET_ADMIN. The mark stays after a failed force.

Both shipped Compose files grant cap_add: [NET_ADMIN]. In the Linux cgo build, a helper holds the capability until listener setup ends; Silo clears its own grant before the Go runtime starts and uses no_new_privs to prevent children regaining privileges. The omnibus image passes the grant across its change to the silo account; if setpriv fails, Silo starts without the grant. Startup logs warn when containment cannot be confirmed.

Without NET_ADMIN, Silo still requests BBR where the host has loaded and allowed it, but cannot force the send buffer. Refusals log the reason and keep serving; address bind errors still fail. The user manual needs an update for the settings and the Compose grant: Silo-Server/siloserver.org#322.

Validation

  • The Go half of the CONTRIBUTING.md gate passes on the final tree: build, gofmt, go vet ./..., make test-go (on Linux), make lint-changed, make lint-router-recovery, every verify-* target, and the committed-router test. Web checks and the pnpm half of verify-settings-bindings-all were not run; no web or settings-manifest file changes.
  • Linux tests run as root with NET_ADMIN, without it, and with the ambient raise refused by seccomp. All pass. In the refused case, the process ends with empty capability sets and no_new_privs set.
  • An omnibus image check covers 17 startup and listener cases, including the 128 KiB low-water mark and the refused-ambient case for Silo and its FFmpeg child. All pass.
  • The omnibus svc-silo script reaches Silo as the silo account in four cases: with the grant, without it, with the ambient raise refused by seccomp, and with a setpriv that fails. The last case fails before the fallback.
  • Lab measurements compare Silo API/proxy throughput and competing flows over emulated links. The low-water sweep has 180 runs, five per configuration. Results and limits are below.
  • Distributed transcode nodes — Server #1177 C1 (proxy and node startup) and C2 (proxy bandwidth-cap routing, which uses measured proxy throughput) have passed results this change can reach. The agent-run results for Downloads / offline — Server #1168 C1 and C2, Compatibility layers (Jellyfin / Audiobookshelf) — Jellyfin compatibility #1246 C1, and Server limits & audit logs — Server #1217 C1 are pending human acceptance and also cover transfers on the tuned listeners; they should be re-tested after merge, along with the Distributed transcode nodes — Server #1177 C3 failover walk.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3280/

Throughput and memory measurements

Silo API/proxy downloads over an emulated 200 Mbit/s link with 40 ms round trips and 1% random loss reached 183.8-184.0 Mbit/s with BBR, versus 3.1-3.2 Mbit/s with congestion tuning off and CUBIC selected (ten runs per arm and route). This comparison used a 1 MiB low-water mark; the 128 KiB selection was measured separately.

With BBR, the 128 KiB mark met the throughput rule in all six tested combinations: forced buffers or autotuning, each on 1 Gbit/s at 100 ms and 1% loss, 200 Mbit/s at 40 ms and 1% loss, and a 25 Mbit/s deep FIFO link. The lowest lower 95% confidence bound was 0.965 times its matching no-mark control (rounded), above the required 0.95. It saved 3-56 MB of send-buffer memory per socket and cost 16-44% more API-container CPU per GB. A 16 KiB mark failed the gigabit case. Cloudflare's web servers use the same 131072-byte mark on their sockets and kept full 1 Gbit/s throughput with it at a 466 ms round trip (Optimizing TCP for high WAN throughput while preserving low latency, 2022). These are lab results, not a throughput guarantee for every deployment.

Risks

  • NET_ADMIN reaches interfaces, routes, firewall rules, and nf_tables kernel code while held; host networking extends that exposure to the host. The container's root processes retain the grant even after Silo releases its helper, including on transcode nodes. Removing cap_add removes this grant only if no other source supplies it.
  • BBR does not improve every shared link. In a 50 Mbit/s deep FIFO test with 40 ms round trips and a competing CUBIC download, kernel BBR held 31-45% of bandwidth across both start orders (five runs per arm and order). In Silo tests behind a 25 Mbit/s policer, the competing CUBIC download received only about 0.3 Mbit/s against BBR. This change adds no automatic fairness guard; SILO_NET_TCP_CONGESTION=off keeps the kernel's choice.
  • A forced buffer disables autotuning and permits up to 64 MiB per connection at the default size. The low-water mark reduces unsent data; it is not a 128 KiB cap on total socket memory. Memory under many concurrent viewers remains unverified.
  • A terminating reverse proxy or port-forwarding proxy owns the client connection, so tuning reaches only its hop to Silo. Client receive limits can still cap throughput. MPTCP clients fall back to TCP.
  • Capability cleanup sets no_new_privs, restricting setuid and file-capability gains in child processes. Builds without the Linux cgo constructor cannot provide this helper or containment path.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code running inside T3 Code (main agent); Codex CLI (implementation, review, and description drafting); Claude Code (verification).
  • Tool(s): Claude Code, T3 Code, Codex CLI.
  • Model(s): Claude Opus 5.5 (claude-opus-5-5), main agent; gpt-6.1-sol, Codex CLI; Claude Sonnet 5.5 (claude-sonnet-5-5), verification.
  • Involvement: AI-assisted.
  • Review fixes (ff6bddd): Claude Code in T3 Code, Claude Opus 5.5 (claude-opus-5-5).
  • Adversarial review: Independent source reviews checked capability containment, malformed helper requests, custom buffer sizes, socket inheritance, and logs. They found a residual inheritable grant after refused ambient raises and forcing that could shrink an existing buffer; the live code corrects both. The final low-water review found no source defect and exercised portable decision tests against the previous implementation; the Linux runtime gaps are listed under Validation.

Note

Add TCP congestion and send-buffer tuning with NET_ADMIN helper for Silo listeners

  • Adds internal/tcpcongestion, which binds listeners with BBR congestion control, TCP_NOTSENT_LOWAT, and forced SO_SNDBUF, then reports classified per-listener results with reasons and remedies. The first accepted connection is read back to verify BBR is active.
  • Adds internal/netadmin, a Linux+cgo helper process that keeps CAP_NET_ADMIN only for the forked helper, while the main process drops NET_ADMIN from its capability sets and enables no_new_privs. The helper serves validated TCP_CONGESTION and SO_SNDBUFFORCE requests over a Unix seqpacket channel.
  • Adds internal/tuning with SILO_NET_TCP_CONGESTION and SILO_NET_TCP_SEND_BUFFER env vars; invalid values fall back to off with a warning.
  • Wires all listeners (API, proxy, Jellyfin, ABS) through tcpcongestion.Listen in main.go, and adds NET_ADMIN to the Compose files and s6 entrypoint with setpriv pass-through. Full contract documented in tcp-congestion.md.
  • Behavioral Change: Silo now requests the NET_ADMIN container capability and spawns a privileged helper child; without NET_ADMIN the listeners fall back to default kernel settings with logged fallback reasons. netadmin.Release is called after listener setup, which terminates the helper.

Macroscope summarized ff6bddd.

Remote clients on lossy or long-round-trip links got far less
throughput than the link allowed. The kernel's default congestion
control backs off on every loss, and a small send-buffer maximum caps
the window. Silo now requests kernel BBR on its client listeners and
lifts a small send-buffer cap where it is allowed to.

The native API, Jellyfin, Audiobookshelf, and standalone proxy
listeners share one socket policy (internal/tcpcongestion). Transcode
mode and the metrics and debug listeners keep their settings. A
refusal from the kernel or the helper is logged with a remedy and the
listener keeps serving. Only a bind error fails.

Two per-node settings are read once at start:

- SILO_NET_TCP_CONGESTION is bbr (default) or off, which keeps the
  kernel's controller.
- SILO_NET_TCP_SEND_BUFFER is a byte size from 1 to 1073741823, or
  off, which keeps send-buffer autotuning. The default is 33554432.
  An invalid value falls back to the default with a warning. The
  upper bound is Linux's INT_MAX/2 limit on a buffer request.

A forced buffer fixes its size and turns autotuning off. Silo forces
it only when the tcp_wmem maximum is below 25000000 bytes, twice the
requested size exceeds that maximum, and the NET_ADMIN helper is
running. Otherwise autotuning stays, and the listener log says why
(not_needed, no_net_admin, and so on) with the fix to apply.

TCP_NOTSENT_LOWAT is 131072 on every Linux client listener. It needs
no capability and applies whether or not a force runs. It bounds the
unsent data queued per connection, and accepted sockets inherit it.
Linux listeners also turn off Go's default MPTCP, because the helper
accepts only plain TCP sockets. MPTCP clients fall back to TCP.

Forcing a buffer needs NET_ADMIN, so Silo confines it. In a Linux cgo
build, a constructor runs before the Go runtime and starts a helper
that holds only NET_ADMIN. The helper accepts two requests, each on
one TCP socket passed by SCM_RIGHTS: set TCP_CONGESTION to bbr, and
set SO_SNDBUFFORCE to a bounded size. Silo then clears NET_ADMIN from
its effective, permitted, inheritable, ambient and bounding sets and
sets no_new_privs. Children cannot regain it through setuid bits or
file capabilities. The helper exits after the last client listener
binds, including the standalone bind in transcode mode. The startup
log reports the capability state and warns when containment cannot be
confirmed.

In the omnibus image, svc-silo passes a granted NET_ADMIN to silo as
an ambient capability through setpriv, after a probe run. Without the
grant, or when setpriv fails, it keeps s6-setuidgid, so a refusal never
keeps Silo from starting.

docker-compose.yml and docker-compose.node.yml add
cap_add: [NET_ADMIN]. Proxy nodes serve clients directly. Transcode
nodes drop the capability at startup. Without NET_ADMIN, Silo still
requests BBR where the host loads and allows it.

While the helper runs, NET_ADMIN can reach interfaces, routes,
firewall rules and nf_tables code, and with network_mode: host, the
host's. Removing cap_add stops the force. Setting both settings to
off stops BBR and the force; the low-water mark stays.
docs/architecture/tcp-congestion.md records the contract and the log
lines.

Signed-off-by: Anagh Kumar Baranwal <[email protected]>
@silo-triage silo-triage Bot added the size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. label Oct 30, 2026
@silo-kody

silo-kody Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Silo now parses TCP tuning settings and applies congestion-control and send-buffer options to its API, compatibility, and proxy listeners. Linux builds add a capability-contained helper for privileged socket options. Deployment files and architecture documentation describe the capability and tuning behavior.

Changes: TCP listener tuning and capability containment

Layer / File(s) Summary
Tuning inputs and TCP decision rules
.env.example, internal/tuning/*, internal/tcpcongestion/decision*, internal/tcpcongestion/buffers*
Configuration parsing sets congestion and send-buffer values, with adjustments for invalid inputs. Decision logic classifies congestion and buffer outcomes and logs results; tests cover parsing and decisions.
NET_ADMIN helper and process containment
internal/netadmin/*, docker-compose*.yml, omnibus/rootfs/etc/s6-overlay/s6-rc.d/svc-silo/run, docs/architecture/omnibus-image.md
Linux code adds a helper for BBR and forced send-buffer requests, tracks capability state, and releases the helper. Startup and Compose changes pass or contain NET_ADMIN; tests cover request validation and capability state.
Socket setup and accepted-connection checks
internal/tcpcongestion/listen_*, internal/tcpcongestion/listen_*_test.go
Listener setup configures congestion and send-buffer options, reads kernel limits, and checks the first accepted connection’s congestion setting on Linux. Non-Linux builds report unsupported outcomes.
Application startup and operating documentation
cmd/silo/*, docs/architecture/observability.md, docs/architecture/tcp-congestion.md, docs/update-to-1.0.md
Startup parses tuning settings and supplies options to API, compatibility, and proxy listeners. Documentation describes the tuning contract, capability setup, and component list.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Startup as Silo startup
  participant Tuning as tuning.Parse
  participant Limits as tcpcongestion.ReadLimits
  participant Listen as tcpcongestion.Listen
  participant Helper as netadmin helper
  Startup->>Tuning: Parse TCP environment settings
  Tuning-->>Startup: Return effective settings and adjustments
  Startup->>Limits: Read TCP limits outside transcode mode
  Limits-->>Startup: Return kernel limit results
  Startup->>Listen: Start listener with TCP options
  opt Privileged socket operation is required and helper is running
    Listen->>Helper: Request socket option change
    Helper-->>Listen: Return operation result
  end
  Listen-->>Startup: Return listener and configuration results
Loading

Possibly related issues

  • Silo-Server/silo-server#1245 — The PR applies TCP tuning to the Jellyfin and Audiobookshelf compatibility listeners, which are relevant to the issue’s client browsing and playback acceptance criterion.

Possibly related PRs

  • Silo-Server/silo-server#3118 — This PR changes the svc-silo startup introduced by #3118 to pass CAP_NET_ADMIN through setpriv when the capability checks succeed.

Suggested labels: impact: usability, evidence-required

Suggested reviewers: quick104

Merge Risk: Low · up to ff6bd

The default node container retains NET_ADMIN in root processes. An interrupted helper reply can also disable later privileged tuning; ordinary signal handling reduces that risk. The change is mergeable with awareness of these limits.

Security architecture risk: Moderate · up to ff6bd

The socket helper has strong containment controls, but default deployments now give long-lived container root processes network-administration authority. This also affects transcode-only nodes, and disabling TCP tuning does not revoke the deployment grant.

Retained concerns

  • Medium · security · observed: Both shipped Compose configurations newly grant NET_ADMIN container-wide, so the helper's short lifetime does not bound the deployment's privileged lifetime. The supervisor and other root processes retain network-administration authority, including on default transcode-only nodes that do not use privileged tuning. Compromise of one of those identities therefore gains broader network and kernel authority than before; switching the tuning settings off does not remove it.
Security review details

Security Blast Radius

  • inferred — The introduced authority is independently present in every container using either shipped Compose grant. Its normal network-administration scope is that container's network namespace, with additional privileged kernel attack surface. A host-network deployment would extend network control to the host, but host networking is not enabled by the inspected service definitions.

Security Findings and Attack Paths

  • inferred — The supported exposure is increased authority after compromise of a capability-retaining container root process, not a demonstrated unauthenticated remote exploit. The new grant permits network changes and access to privileged networking interfaces after such a compromise. Successful Silo containment and the private helper channel substantially limit propagation from ordinary application execution.

Trust Boundaries and Controls

  • observed — The helper's enforcement boundary is socket type, operation, and argument validation, not named-listener provenance. Current production callers are confined to listener setup, and remote clients are not given a helper endpoint. On successful initialization, the helper retains only NET_ADMIN in its effective and permitted sets and enables no_new_privs; Silo separately clears its grant and enables no_new_privs.

Resilience and Maintainability Implications

  • observed — Listener setup precedes helper release, including synchronous compatibility binds. Release is serialized and idempotent, closes the channel, and reaps the helper. Parent-death signaling and channel closure provide abnormal-exit cleanup, while malformed requests cannot retain received descriptor references after a reply.

Hardening Proposals

  • proposed — Make the container-wide capability grant an explicit deployment choice rather than the default, particularly for transcode-only nodes. Preserve a capability-free configuration for environments that prefer kernel-provided tuning over the additional authority.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 13.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: improving remote-viewer throughput on lossy, long-latency links through network tuning.
Description check Passed The description directly explains the TCP tuning, NET_ADMIN helper, affected listeners, configuration, validation, risks, and expected behavior.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 53 functions across 15 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp

macroscopeapp Bot commented Oct 30, 2026

Copy link
Copy Markdown

The TCP congestion and send-buffer changes in internal/tcpcongestion/listen_linux.go, wired to the API and proxy listeners in cmd/silo/main.go, can change remote playback/download throughput. The Evidence section says there is no user-visible change; the throughput measurements in the description do not show the playback behavior. Please add a before-and-after recording of the same remote playback on the same link, and identify the surface and build or commit.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@silo-triage silo-triage Bot added enhancement New feature or request go Pull requests that update go code impact: security Auth, privacy, or permission boundary needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish labels Oct 30, 2026
@coderabbitai coderabbitai Bot added evidence-required Needs before-and-after evidence before the Evidence check passes impact: usability Core flow broken or severely blocked labels Oct 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up Comments

Nitpick Do not grant NETADMIN by default on a node whose default MODE is transcode.

15-24: Trivial · Security & Privacy · Detected with Advanced Tier · Quick win

Security Misconfiguration

Reachability: Internal
Exploitability: Difficult
CWE: CWE-250

Do not grant NET_ADMIN by default on a node whose default MODE is transcode.

This file sets MODE: ${MODE:-transcode}. The new comment says a transcode node "uses nothing from it". A default deployment therefore gives every root process in the container NET_ADMIN with no benefit. The comment also says this reaches the host network under network_mode: host.

Only proxy nodes use the capability. Ship the line commented out, and tell proxy-node operators to enable it. This keeps the default at least privilege.

🔒 Proposed change
-    # Proxy nodes serve clients directly and use NET_ADMIN for kernel BBR and
-    # larger TCP send buffers. On transcode nodes Silo drops it at startup
-    # and uses nothing from it; the container's root processes keep it.
+    # Proxy nodes (MODE=proxy) serve clients directly and can use NET_ADMIN for
+    # kernel BBR and larger TCP send buffers. Uncomment the line below only on
+    # a proxy node. A transcode node uses nothing from it, and the container's
+    # root processes would keep it.
     # A small helper exits after listener setup; Silo and its children never
     # keep it, and the startup log reports a failed drop.
     # While held, it can change interfaces, routes and firewall rules and
     # reaches nf_tables; with network_mode: host, this includes the host.
-    # Undo: remove this line. SILO_NET_TCP_CONGESTION=off turns BBR off.
+    # Undo: remove the line. SILO_NET_TCP_CONGESTION=off turns BBR off.
     # SILO_NET_TCP_SEND_BUFFER=off keeps send-buffer autotuning.
-    cap_add: [NET_ADMIN]
+    # cap_add: [NET_ADMIN]

Open the source location


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6734a36-b30c-48a7-aa5e-52d71fcdaf0c
Commits

Reviewing files that changed from the base of the PR and between 7cd8804 and b9e280c.

Files selected for processing: 23
  • .env.example
  • cmd/silo/compat_listener.go
  • cmd/silo/main.go
  • docker-compose.node.yml
  • docker-compose.yml
  • docs/architecture/observability.md
  • docs/architecture/omnibus-image.md
  • docs/architecture/tcp-congestion.md
  • docs/update-to-1.0.md
  • internal/netadmin/netadmin_linux.go
  • internal/netadmin/netadmin_linux_test.go
  • internal/netadmin/netadmin_other.go
  • internal/netadmin/state.go
  • internal/tcpcongestion/buffers.go
  • internal/tcpcongestion/buffers_test.go
  • internal/tcpcongestion/decision.go
  • internal/tcpcongestion/decision_test.go
  • internal/tcpcongestion/listen_linux.go
  • internal/tcpcongestion/listen_linux_test.go
  • internal/tcpcongestion/listen_other.go
  • internal/tuning/tuning.go
  • internal/tuning/tuning_test.go
  • omnibus/rootfs/etc/s6-overlay/s6-rc.d/svc-silo/run

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

When the constructor's first capget failed, Silo started with an
unknown capability state and did not set no_new_privs. Child processes
could then still gain privileges through setuid bits or file
capabilities.

The constructor now sets PR_SET_NO_NEW_PRIVS on that path too. It still
cannot rewrite capability sets it could not read, so it skips that step
and keeps the bounding and ambient drops that need no read. Startup
continues, because a refusal must never stop the container. The startup
log already reports containment as unproven.

docs/architecture/tcp-congestion.md records the inspect_failed path.

Signed-off-by: Anagh Kumar Baranwal <[email protected]>
@silo-kody

silo-kody Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@darthShadow

Copy link
Copy Markdown
Contributor Author

@coderabbitai Two replies to your review of b9e280c.

NET_ADMIN by default in docker-compose.node.yml: kept on purpose. The grant is on for every node so that a proxy node gets BBR and send-buffer tuning without an extra step. A transcode node drops it at startup, and the comment above the line states the scope and how to remove it.

No no_new_privs when the first capget fails: fixed in f9111f3. That path now sets PR_SET_NO_NEW_PRIVS, and TestInspectFailureReportsUnprovenContainment requires it. A failed capset stays a logged warning by design: Silo cannot rewrite capability sets it could not read, and a capability refusal must never stop the server from starting. The startup log reports containment as unproven in both cases.

@macroscopeapp

macroscopeapp Bot commented Oct 30, 2026

Copy link
Copy Markdown

Re-validation needed: The recorded #1177 C1 and C2 results (build 1804 · cc851494) no longer cover the changed paths. C1 exercises node startup and registration, while the new constructor and helper alter the node startup capability path; C2 checks job/bandwidth-cap scheduling, where proxy BBR and send-buffer tuning can change health-reported egress. Please explain why these previously validated behaviors change and revalidate both cases after merge. The cited #1168 C1/C2, #1246 C1, and #1217 C1 task bodies currently record Not run, so they have no existing results to revalidate.

Suggested fix: No diff; after merge, rerun #1177 C1 and C2 against the resulting build and record the results in #1177.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
cat AGENTS.md
fd -H '^AGENTS\.md$' internal cmd
ast-grep outline internal/netadmin/netadmin_linux.go --items all
ast-grep outline internal/netadmin/netadmin_linux_test.go --match TestInspectFailureReportsUnprovenContainment --view expanded
rg -n -C 9 'NET_ADMIN|cap_add' docker-compose.node.yml
rg -n -C 18 'capget|capset|PR_SET_NO_NEW_PRIVS|constructor' internal/netadmin/netadmin_linux.go
rg -n -A 65 -B 5 'func TestInspectFailureReportsUnprovenContainment' internal/netadmin/netadmin_linux_test.go
rg -n -C 6 'netadmin.Release|serverModeTranscode|ModeTranscode' cmd/silo/main.go

Length of output: 37046


@darthShadow Thanks for the clarification.

  • Default NET_ADMIN: I withdraw the recommendation to remove it from docker-compose.node.yml. The default supports proxy nodes by design. The comment documents the security scope and removal steps. The transcode startup path does not apply TCP tuning and releases the helper.
  • Failed initial capget: Source inspection confirms that this path now attempts PR_SET_NO_NEW_PRIVS and reads back the result. TestInspectFailureReportsUnprovenContainment requires NoNewPrivs=true while keeping containment marked as unproven.
  • Failed capset: I accept the nonfatal behavior. A warning must not imply successful capability removal. no_new_privs does not remove capabilities that the process still holds.

This addresses the missing no_new_privs attempt. I inspected the regression test but did not run it.


✏️ Learnings added
Learnt from: darthShadow
URL: https://github.com/Silo-Server/silo-server/pull/3280

Timestamp: 2026-10-30T15:45:54.785Z
Learning: Within repository "Silo-Server/silo-server", only for files matching one of ["internal/netadmin/netadmin_linux.go"]: When reviewing startup capability-failure handling in internal/netadmin/netadmin_linux.go, preserve the intentional nonfatal behavior for refused capability operations. Check that a failed initial capget still attempts PR_SET_NO_NEW_PRIVS without rewriting unknown capability sets, and that failed inspection or failed capability removal reports containment as unproven rather than successful. Do not require server startup to stop solely because a capability operation was refused.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Tests

A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:

- Don't test small changes, UI layout or copy, pass-through wiring, constants and defaults, or
  frozen `/api/v1` behavior beyond its own authorization checks.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Tests

A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:

- Add or extend a test for security and authority checks, data integrity, public contracts
  (`/api/v2`, jellycompat, the plugin protocol), failure handling, and logic with real edge cases,
  and when fixing a bug in one of those.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## Building and verifying

`make test-go` runs the whole Go suite. A Go test that cannot pass yet carries a `t.Skip` and the
reason in its own source, not an entry in a Makefile variable. `make test-web` still skips the
files in `WEBTEST_KNOWN_FAILURES`, which predate the CI gate; that list may only shrink — delete an
entry together with its fix, and never add to it to make a new change pass.
Learnt from: darthShadow
Repo: Silo-Server/silo-server PR: 2522
File: .github/actions/ci-tools/go-checks.mk:26-26
Timestamp: 2026-10-16T05:49:37.885Z
Learning: In Silo-Server/silo-server, .github/actions/ci-tools/go-checks.mk uses UNCACHED both for the exact subprocess-package comparison and for an unconditional go test invocation. Filtering missing directories only from the comparison does not make a list-first landing safe. Trusted CI tooling does not by itself require staging when a PR adds test packages and their UNCACHED entries together.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Tests

A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:

- A new test that needs Postgres goes in `scripts/ci/db-contracts.txt` (or `db-pins.txt` for a
  query budget) in the same change, or isn't written; CI skips database tests no list or job
  selects. CI has no Redis, so don't add tests that need one.
Learnt from: neurekadev
Repo: Silo-Server/silo-server PR: 1487
File: docs/wiki/deployment/docker.md:0-0
Timestamp: 2026-09-26T00:41:43.199Z
Learning: In `docker-compose.yml`, the Meilisearch service must explicitly pass `MEILI_UPGRADE_DB` for a value in the project `.env` to reach the container. With `MEILI_UPGRADE_DB=false`, Meilisearch v1.54.0 refuses data written by v1.53.2 rather than upgrading it.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Tests

A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## Gotchas

**Docs hygiene.** Implementation plans and specs are ephemeral working artifacts, not
documentation. `docs/superpowers/` is gitignored: write plans there (or in any scratch dir)
while working, but never commit them — put the plan in the PR description instead. Before a
branch merges, distill anything durable (invariants, protocols, security rules) into
`docs/architecture/` and let the plan die. The code is the source of truth; a doc that
disagrees with the code is wrong. Any committed doc must not contain local absolute
filesystem paths or transient worktree IDs — use repository-relative paths and wording like
"Commands assume the repository root is the cwd." `make verify-local-paths` enforces this.
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 1779
File: .github/workflows/trusted-linux-ci.yml:110-124
Timestamp: 2026-10-02T00:39:38.996Z
Learning: In Silo-Server/silo-server, .github/workflows/trusted-linux-ci.yml uses changed-line lint to catch honest mistakes in member PRs already permitted to run on these runners. It is not a security boundary against hostile PR code. PR-controlled setup runs before lint and can change the lint execution environment. Re-checking out .ci-tools immediately before lint does not establish that boundary. The select and result jobs run no PR-controlled code and must retain their trusted-tool separation.
Learnt from: zenjabba
Repo: Silo-Server/silo-server PR: 1575
File: internal/adminjob/image_cache_cleanup.go:70-70
Timestamp: 2026-09-27T14:13:05.743Z
Learning: In `internal/adminjob/runner.go`, the image-cache cleanup slice is intended as a scheduling bound, not a hard deadline. `internal/blobstore/filesystem.go` checks the context for each entry during the `Filesystem.DeletePrefix` walk, but its subsequent `RemoveAll` call is not context-aware.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Tests

A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:

- Don't write tests that match strings in source, CSS, or docs files, or that only check a fake
  received the test's own inputs.
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 2413
File: web/src/contexts/BrandingProvider.tsx:98-99
Timestamp: 2026-10-13T20:09:31.279Z
Learning: The web client's admin accent intentionally recolors only `primary`, `ring`, and `sidebar-primary`. In PR #2413, `web/src/contexts/BrandingProvider.tsx` preserves the token mapping previously defined in `web/src/lib/accentMapping.ts` so saved accents retain their appearance after upgrade. The Cinema Dark foreground tokens remain unchanged. Dark-accent contrast is a pre-existing issue, not a regression introduced by moving accent application to BrandingProvider.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## What Silo is

Taste: KISS and YAGNI win — the simple design beats the clever one, provided it survives both
the single-node and the multi-node deployment. Current posture: the 1.0 feature set is
essentially complete; the present era is QA, UX polish, and verifying everything does what it
says. Prefer correctness and polish over new feature sprawl.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## What Silo is

A modern, open-source media server built from the ground up on current infrastructure —
Postgres, S3, Redis — rather than SQLite and local disk. The foundational bet is horizontal
scale: Silo deploys as a cluster (Kubernetes, remote transcode nodes) and stays fast on large
libraries, whether it's one node serving a household or a deployment streaming to thousands of
users. Weigh every design against that full spectrum; treat a node dying mid-stream as a normal
event, not an edge case.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Gotchas

**Profiles vs accounts.** Login accounts (`users`) are separate from household profiles; several
profiles on one account share a `user_id`. A profile's `is_primary` marks the household parent,
which is *not* the server-wide `admin` role on the account.
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 1767
File: web/src/player/playback-info.ts:0-0
Timestamp: 2026-10-01T23:14:06.644Z
Learning: In Silo-Server/silo-server, the server quality ladder lists rungs tallest first. When the source fits a resolution-only preference but a bitrate cap forces a transcode, the server uses the tallest available Medium rung. The web resolver in web/src/player/playback-info.ts should select that rung rather than require a rung at the preferred height. When the source exceeds the preferred height, it should retain the exact <height>p-medium match.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## Development environment

Copy `.silo-dev.env.example` to `.silo-dev.env` and fill in how to
reach your Silo deployment — URL, SSH target, database, an account to debug with. That file is
gitignored and is the only place hosts, passwords, and tokens belong. `scripts/silo-dev doctor`
checks it end to end.
Learnt from: crowquillx
Repo: Silo-Server/silo-server PR: 1344
File: internal/scanner/theme_songs.go:115-140
Timestamp: 2026-09-24T13:41:22.725Z
Learning: In `internal/themesongs/repository.go`, `Repository.Directories` must skip noncanonical directory paths derived from stored `media_files.file_path` values rather than clean them: theme ownership and pruning queries match stored paths literally, so a cleaned directory would be an unmatched owner alias. In `internal/scanner/theme_songs.go`, `themeDiscovery.ancestorRules` must reject directories outside the cleaned library root before reading ancestors.
Learnt from: blurbery
Repo: Silo-Server/silo-server PR: 2731
File: internal/jellycompat/dto.go:128-128
Timestamp: 2026-10-19T22:56:48.794Z
Learning: In Silo's Go Jellyfin compatibility layer, `baseItemDTO.MediaSources` in `internal/jellycompat/dto.go` is type-dependent: movies and episodes should emit `"MediaSources":[]` when requested but no present version exists, including full detail responses. Series and seasons should omit `MediaSources`, since they have no media sources in Jellyfin.
Learnt from: Rhainland
Repo: Silo-Server/silo-server PR: 2230
File: web/src/player/components/SeekBar.tsx:391-393
Timestamp: 2026-10-10T19:29:08.500Z
Learning: In Silo-Server/silo-server, the React/TypeScript component web/src/player/components/SeekBar.tsx intentionally gives loaded trickplay tiles priority over marker and chapter thumbnail images. Trickplay tiles show the frame at the hovered time; marker thumbnails show the marker's start. Marker labels and ranges remain visible below the trickplay tile. Do not recommend prioritizing marker thumbnails over loaded trickplay tiles.
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 2505
File: internal/api/handlers/profiles.go:828-829
Timestamp: 2026-10-15T03:17:00.696Z
Learning: In Silo-Server, ProfileHandler.DeleteProfile in internal/api/handlers/profiles.go uses an intentional best-effort, logged-on-failure contract for cross-store post-delete purges, including ebook reader data, dropped series, watchlist titles, and recommendation state. Durable retry or recovery should be considered across these purges as a separate architectural change, rather than required for an individual purge addition.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## Priorities

Performance and reliability first. Keep behavior predictable under load and during failures —
session restarts, reconnects, partial streams. When a tradeoff is forced, choose correctness and
robustness over short-term convenience.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: docs/non-goals.md:0-0
Timestamp: 2026-10-21T01:19:03.813Z
Learning: Applicability reference:
AGENTS.md: # Silo Server
## Non-goals
Most of this codebase's scope is open; a short list is permanently closed. Read
[docs/non-goals.md](docs/non-goals.md) before proposing or implementing in those areas.

Source excerpt:
# Non-goals

## Live TV, OTA tuners, IPTV, and remote stream shortcuts

### What to do instead

Silo does not assume it is the only media server on the box. Run Jellyfin, Plex, or a dedicated
tuner/IPTV backend alongside it for live TV, and use Silo for the on-disk library. That
separation also keeps the risk where it belongs, on software whose distribution model can absorb
it.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## Non-goals

**Live TV, OTA/DVB tuners, IPTV, EPG/XMLTV, DVR, and `.strm` remote-URL shortcuts will not be
accepted** — not in core, not as a plugin, not in a client. The first-party clients ship on the
Apple and Google stores, and a server that plays arbitrary remote stream URLs puts the whole
client suite at risk. This is settled product direction, not a design problem to solve; do not
write code for it, and say so plainly if asked.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server

## API contract rules

Design new endpoints today so they can live under that regime tomorrow.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: docs/non-goals.md:0-0
Timestamp: 2026-10-21T01:19:03.813Z
Learning: Applicability reference:
AGENTS.md: # Silo Server
## Non-goals
Most of this codebase's scope is open; a short list is permanently closed. Read
[docs/non-goals.md](docs/non-goals.md) before proposing or implementing in those areas.

Source excerpt:
# Non-goals

## Live TV, OTA tuners, IPTV, and remote stream shortcuts

**Out of scope permanently.** This covers, at minimum:

- IPTV: M3U/M3U8 playlist ingestion, provider portals, Xtream-style APIs, stream relays.
Learnt from: Rhainland
Repo: Silo-Server/silo-server PR: 2211
File: internal/apiv2/catalog_actions.go:274-274
Timestamp: 2026-10-10T10:39:13.742Z
Learning: In Silo-Server/silo-server, the v2 shared problem writer sets Retry-After for rate-limit responses. Documentation of this header in OpenAPI should cover all rate-limited v2 routes as a contract-wide change, rather than adding it for one operation in an unrelated PR.
Learnt from: RXWatcher
Repo: Silo-Server/silo-server PR: 132
File: internal/api/handlers/events_ws.go:321-329
Timestamp: 2026-06-11T12:18:48.143Z
Learning: In `internal/api/handlers/events_ws.go` (silo-server, Go), per-profile and child-safe filtering of WebSocket notification events is intentionally done client-side (in `RealtimeEventsProvider`), not server-side. This is because: (1) browsers cannot set custom headers on WebSocket handshakes so the active profile cannot be sent at connection time, (2) the WS connection is per-account and not reconnected on profile switch so any server-side profile filter keyed on connect-time profile would go stale. The REST endpoints (`GET /notifications`, `/notifications/unread-count`) are the authoritative profile-scoped and child-safe boundary. The WS snapshot unread count is a documented best-effort approximation. The cross-user trust boundary IS enforced server-side via `allowsEventForClaims`, which blocks another user's notifications/requests events even from admins.
Learnt from: Rhainland
Repo: Silo-Server/silo-server PR: 2282
File: internal/api/handlers/playback_realtime.go:273-273
Timestamp: 2026-10-13T08:20:10.429Z
Learning: In Silo-Server's Go playback handlers, confirmed pause/resume handling in internal/api/handlers/playback_realtime.go and progress side effects share a per-session lock while sending watch-provider scrobbles. Slow scrobbles can therefore delay state updates in both paths. Decoupling confirmed state updates from provider work requires coordinating both paths to preserve transition deduplication and scrobble order; removing the lock or deferring only confirmed-result scrobbles is not sufficient.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: docs/non-goals.md:0-0
Timestamp: 2026-10-21T01:19:03.813Z
Learning: Applicability reference:
AGENTS.md: # Silo Server
## Non-goals
Most of this codebase's scope is open; a short list is permanently closed. Read
[docs/non-goals.md](docs/non-goals.md) before proposing or implementing in those areas.

Source excerpt:
# Non-goals

## Live TV, OTA tuners, IPTV, and remote stream shortcuts

**Out of scope permanently.** This covers, at minimum:

- Live TV of any kind, including OTA tuners (HDHomeRun and equivalents) and DVB devices.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

Silo is pre-1.0, with the current focus on QA, correctness, and UX polish.
Architectural changes are welcome when they serve the requested outcome and improve
long-term maintainability; keep unrelated redesign out of a bounded fix.

If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of f9111f3.

I found two defects and two places where the docs don't match what runs. I'm fixing all four in a commit on this branch. Five points need a maintainer decision. Each is inline.

The containment held up under test. On a rootful Docker host, root with --cap-add NET_ADMIN ends with NET_ADMIN cleared from Silo's effective, permitted and bounding sets and from an exec'd child, and the SILO_TEST_NET_ADMIN=1 tests pass. f9111f3 already covers the missing no_new_privs on the capget-failure path, so it isn't in this list. A summary with scores follows after the fixes are pushed.

🤖 Claude Code in T3 Code (claude-opus-5-5)

Comment thread internal/netadmin/netadmin_linux.go Resolved
Comment thread internal/tuning/tuning.go Resolved
Comment thread docker-compose.yml Resolved
Comment thread docs/architecture/omnibus-image.md Resolved
data[0].effective &= ~(1U << CAP_NET_ADMIN);
data[0].permitted &= ~(1U << CAP_NET_ADMIN);
data[0].inheritable &= ~(1U << CAP_NET_ADMIN);
if (silo_capset(data) < 0) silo_record_error(errno);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium, maintainer decision. If a seccomp profile denies capget or capset, startup continues with NET_ADMIN still in Silo's effective and permitted sets on every thread, and logs a warning. Silo's own code then holds the capability that the helper exists to confine, and no_new_privs doesn't remove a capability the process already has. The cross-provider review reproduced both cases with syscall filters: inspect_failed and start_failed, each with bit 12 still set in CapEff. Docker's default seccomp profile allows both calls, so the shipped Compose files don't reach this.

The open question is whether Silo should refuse to start when it was granted NET_ADMIN and can't drop it, or keep warning as the latest commit chose. I'm leaving this for the maintainers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep starting. A capability call that the environment refuses should never stop the server. That case only arises when an operator granted NET_ADMIN and also runs a seccomp profile that denies capget or capset, and Docker's default profile allows both. Refusing to start would turn a hardening step into an outage for that operator. The startup log already warns that containment is unproven, and no_new_privs still blocks children from gaining privileges.

if (ambient < 0 && errno == EINVAL) ambient = 0;
else if (ambient < 0) silo_record_error(errno);
uint32_t retained = data[0].effective | data[0].permitted | data[0].inheritable;
if (!(retained & (1U << CAP_NET_ADMIN)) && bounding == 0 && ambient == 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer decision. Linux's default bounding set includes NET_ADMIN, so this condition is false for every non-root run outside a container: bare metal, systemd units, make dev-backend. Those runs take the cleanup path and set no_new_privs for Silo and everything it starts, though nothing granted them NET_ADMIN, even with both tuning settings off. I confirmed it on a bare-metal run: HeldAtStart:false Helper:none, and NoNewPrivs: 1 in the parent and in an exec'd child.

None of the programs Silo starts itself (FFmpeg, ffprobe, nvidia-smi, git, plugins) relies on setuid bits or file capabilities, so I found nothing that breaks. It does block privilege gains for third-party plugins and wrapper scripts, and it limits SELinux and AppArmor exec transitions.

The alternative is to clean up only when NET_ADMIN is in the effective, permitted, inheritable or ambient set. Ordinary launches would then be left alone, but a container that grants NET_ADMIN only through the bounding set would lose no_new_privs. That includes the svc-silo fallback when setpriv fails. I'm correcting the doc so it says ungranted non-root runs get no_new_privs. The behavior is left for the maintainers.

Comment thread docker-compose.node.yml
# reaches nf_tables; with network_mode: host, this includes the host.
# Undo: remove this line. SILO_NET_TCP_CONGESTION=off turns BBR off.
# SILO_NET_TCP_SEND_BUFFER=off keeps send-buffer autotuning.
cap_add: [NET_ADMIN]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer decision. This file defaults to MODE=transcode, which binds no tuned client listener, so a default node gains nothing from NET_ADMIN. The grant still stays with the container's root processes while the container runs, as the comment says. Shipping the line commented out, with a note that proxy nodes need it, would remove that exposure from transcode nodes; proxy nodes would then need one more edit. CodeRabbit raised the same point. I'm leaving it for the maintainers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the grant on by default. It's there so a node switched to proxy mode gets BBR and buffer tuning with no extra edit. Proxy egress is where the gain lands, and a commented-out line is easy to miss. On a transcode node, Silo drops it at startup, and the comment above the line gives the scope and how to remove it.

"golang.org/x/sys/unix"
)

func TestHelperRefusesInvalidRequests(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer decision. The tests in this file and TestListenForcesSendBufferThroughHelper run only when SILO_TEST_NET_ADMIN is set. Nothing in the workflows, the Makefile or scripts/ci sets it, so CI skips all of them, and a regression in the containment or helper protocol would pass CI. On a rootful Docker host, as root with --cap-add NET_ADMIN, the SILO_TEST_NET_ADMIN=1 cases pass on this head. On rootless Docker the forced-buffer cases fail with EPERM, as the doc says they should.

Options: a CI job that runs go test ./internal/netadmin ./internal/tcpcongestion in a container with --cap-add NET_ADMIN and SILO_TEST_NET_ADMIN=1 (GitHub-hosted runners have rootful Docker), or dropping the variants that need custom seccomp launchers. Left for the maintainers.

})

func configureSendBuffer(fd int, in *sendBufferInput) {
in.lowatErr = unix.SetsockoptInt(fd, unix.IPPROTO_TCP, unix.TCP_NOTSENT_LOWAT, notSentLowat)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer decision. TCP_NOTSENT_LOWAT=131072 applies to every Linux client listener whatever the settings say, and these listeners also turn MPTCP off. So SILO_NET_TCP_CONGESTION=off with SILO_NET_TCP_SEND_BUFFER=off, which .env.example and the Compose comments present as the undo, still changes every client socket. The PR measured 16 to 44% more API-container CPU per GB with the mark. It hasn't measured many concurrent viewers on low-end hardware.

One option: when both settings are off, leave the listeners exactly as before (no mark, Go's default MPTCP), so operators have a full rollback. Left for the maintainers.

- The netadmin constructor opens /dev/null on a closed fd 0, 1 or 2
  before creating the helper's socket pair, as the Go runtime does later.
  A launcher that closed stderr gave the helper fd 2, so log lines went
  to the helper, its replies fell out of step, and Release closed stderr.
  If a standard descriptor can't be reserved, the helper does not start.
- SILO_NET_TCP_CONGESTION and SILO_NET_TCP_SEND_BUFFER turn off on a
  value they don't recognize, such as false or 0, as internal/envutil
  does for flags that default on. They used to keep BBR and the forced
  buffer on.
- docker-compose.yml and tcp-congestion.md say that the container's root
  processes keep a NET_ADMIN grant while the container runs. The docs no
  longer describe svc-silo starting Silo after a refused ambient raise,
  say that non-root runs outside a container get no_new_privs, and list
  frontend mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review summary for ff6bddd

Fit: 6/10 · Readiness: 6/10 — conditional (assuming CI is green)

Fit. Remote viewers on lossy or long links get much less throughput than their connection allows, and this PR measures a large gain with BBR. The cost is complexity and privilege. Every default install now grants NET_ADMIN to the container. A C constructor manages capabilities before the Go runtime starts. The PR adds two settings, and a socket option that the PR measured at 16 to 44% more CPU per GB applies everywhere. AGENTS.md prefers the simple design over the clever one, which is the open tension here.

Readiness. The containment works. Root with --cap-add NET_ADMIN ends with NET_ADMIN cleared from Silo and its children, and the privileged tests pass on a rootful Docker host. What holds the score down: the maintainer decisions below, CI never running the privileged tests, and throughput gains shown only in the PR's lab runs, not reproduced here.

Fixed in ff6bddd

  • A closed fd 0 to 2 at startup no longer becomes the helper channel. TestHelperChannelAvoidsClosedStdio fails on f9111f3 (helper fd = 2) and passes now.
  • An unrecognized value for SILO_NET_TCP_CONGESTION or SILO_NET_TCP_SEND_BUFFER (for example false or 0) turns that setting off instead of leaving it on. The new TestParse rows fail on b9e280c.
  • docker-compose.yml and tcp-congestion.md now say that the container's root processes keep the grant while the container runs.
  • The docs no longer describe svc-silo starting Silo after a refused ambient raise. They now say that ungranted non-root runs get no_new_privs, and they list frontend mode.

f9111f3 had already set no_new_privs on the capget-failure path.

For the maintainers

  1. Default grant. Should the shipped Compose files grant NET_ADMIN by default? The alternative is to keep the unprivileged BBR attempt and the low-water mark, drop the helper and the grants, and offer an opt-in net.ipv4.tcp_wmem sysctl for bridge networks. That alternative gives up BBR on hosts that haven't allowed it, which is most of them, and gives up larger buffers on untuned hosts. A tcp_congestion_control sysctl stops the container from starting where BBR isn't available, and Docker refuses tcp_wmem with host networking. So those sysctls can only be opt-in.
  2. Failed drop. When capget or capset is denied, Silo keeps NET_ADMIN and only warns. Should it refuse to start instead? f9111f3 chose to keep starting.
  3. no_new_privs without a grant. Non-root runs outside a container (bare metal, systemd) get no_new_privs even though nothing granted them NET_ADMIN.
  4. Transcode nodes. docker-compose.node.yml grants NET_ADMIN, but its default MODE=transcode uses none of it.
  5. CI. The privileged tests only run when SILO_TEST_NET_ADMIN is set, and nothing in CI sets it.
  6. Full off switch. With both settings off, the low-water mark and the MPTCP opt-out still apply.

Each one has an inline thread.

Checks

  • Tests: the PR's own tests live in packages it adds, so they don't build on the base and don't show detection of a fix. Silo's own children (FFmpeg, ffprobe, nvidia-smi, git, plugins) don't rely on setuid or file capabilities, so I found nothing that no_new_privs breaks.
  • Validated features: Distributed transcode nodes — Server #1177 C1 and C2 show a minor change. The client listeners on proxy and node startup get new socket options, and proxy egress is measured on those sockets. I found no regression by tracing the code. The board script couldn't read the project, so the trace used the case tables in the issues.
    Validation tasks: changes #1177 C1, C2. This matches the PR body. Re-test those cases after merge.
  • User manual: docs: explain TCP tuning settings and the Compose NET_ADMIN grant siloserver.org#322 covers it. I updated it for the change to unrecognized values.
  • Apple and Android: no client change. Neither app uses MPTCP.
  • jellycompat: the Jellyfin listener gets the same socket policy, with no protocol change.
  • Cross-provider review (Codex, gpt-6.1-sol, on b9e280c): three findings. Each one became items 2, 3 and 4. Its recommendation on approach is item 1.
  • CI: Web test (4/4) fails in MovieContent.test.tsx with No QueryClient set. That test came from main (fix(web): scope match and split searches for items in several libraries #2721), and this PR touches no web files. test(web): render MovieContent in a QueryClient in the library scope test #3282 fixes it. Rerun the job after test(web): render MovieContent in a QueryClient in the library scope test #3282 merges.
  • Other reviews: CodeRabbit's two points are items 2 and 4. Kody left no inline findings. CodeRabbit's later suggestion to retry EINTR in receiveReply doesn't apply. The Go runtime installs every signal handler with SA_RESTART, and the helper socket has no receive timeout, so recvmsg restarts instead of returning EINTR. No change.
  • Author's position: @darthShadow prefers keeping the default grant (item 1), continuing to start when the drop fails (item 2), and keeping the grant on transcode nodes so a node switched to proxy mode needs no extra edit (item 4). Those items stay open for the maintainers.

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3280/

🤖 Claude Code in T3 Code (claude-opus-5-5)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Retry EINTR before releasing the helper. · netadmin_linux.go:352-374

internal/netadmin/netadmin_linux.go:352-374
Minor · Functional Correctness · Quick win

Retry EINTR before releasing the helper.

receiveReply wraps an EINTR from Recvmsg, so socketOption treats a signal interruption as a transport failure and permanently releases the helper. Listen then skips privileged send-buffer tuning for later sockets and falls back to the non-helper congestion path. The helper's own receive loop already retries EINTR.

Suggested fix
 func receiveReply() error {
 	var reply [4]byte
-	n, _, flags, _, err := unix.Recvmsg(helper.fd, reply[:], nil, 0)
+	var n, flags int
+	var err error
+	for {
+		n, _, flags, _, err = unix.Recvmsg(helper.fd, reply[:], nil, 0)
+		if !errors.Is(err, unix.EINTR) {
+			break
+		}
+	}
 	if err != nil {
 		return fmt.Errorf("receive reply: %w", err)
 	}

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cbff184f-7ca3-4e7a-bd32-468ce99e2d01
Commits

Reviewing files that changed from the base of the PR and between f9111f3 and ff6bddd.

Files selected for processing: 7
  • docker-compose.yml
  • docs/architecture/omnibus-image.md
  • docs/architecture/tcp-congestion.md
  • internal/netadmin/netadmin_linux.go
  • internal/netadmin/netadmin_linux_test.go
  • internal/tuning/tuning.go
  • internal/tuning/tuning_test.go
Files skipped from review as they are similar to previous changes: 2
  • docs/architecture/omnibus-image.md
  • docker-compose.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@darthShadow

Copy link
Copy Markdown
Contributor Author

@Quick104 Thanks for the fixes in ff6bddd. On the default grant (item 1), my reasoning for keeping it on by default:

Without NET_ADMIN, Silo can select BBR only where the host already loads tcp_bbr and lists it in net.ipv4.tcp_allowed_congestion_control. Most hosts don't, so an opt-in grant means most installs keep CUBIC. On the lossy 200 Mbit/s, 40 ms test link that was 3.1-3.2 Mbit/s against 183.8-184.0 Mbit/s with BBR. As you note, the sysctl alternatives can only be opt-in. A tcp_congestion_control sysctl stops the container where BBR is missing, and Docker refuses tcp_wmem with host networking. The grant is the one default that works on an untuned host. The helper confines it, and SILO_NET_TCP_CONGESTION=off plus removing the cap_add line undoes it.

@Quick104
Quick104 merged commit e9bea94 into Silo-Server:main Oct 30, 2026
31 of 33 checks passed
Quick104 added a commit that referenced this pull request Oct 30, 2026
#3280 added cap_add: [NET_ADMIN] to docker-compose.yml and the node file, so
Silo can use kernel BBR and a larger send buffer for remote clients. The
split stack's file lacked it. The regular image runs Silo as root, which
still has no NET_ADMIN unless Compose grants it, so add the same grant.
Silo's startup helper confines it there as in the omnibus image.

tcp-congestion.md names the two shipped files that grant it now that node
hosts run docker-compose.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@darthShadow
darthShadow deleted the feat/tcp-congestion-bbr branch October 30, 2026 18:28
Quick104 added a commit that referenced this pull request Oct 30, 2026
…p two Compose files (#3279)

* fix(compose): move a multi-container install only when asked

docker-compose.yml runs the omnibus image, and its postgres service copied
an install of the earlier multi-container stack into the single container on
the next docker compose up. Existing installs were moved without asking.

The postgres service now stops before Silo starts when it finds such an
install, unless .env sets MIGRATE_COMPOSE_STACK=true. Its message offers both
choices: keep the layout by selecting docker-compose.split.yml, which is the
earlier Compose file unchanged on the regular image, or opt into the move.
REQUIRE_COMPOSE_MIGRATION still keeps Silo from creating an empty database
meanwhile. Installs already moved, and omnibus installs of their own, are
unaffected. New installs keep the single-container default.

The image-pin check now runs after this one, so an install that keeps its
layout is not told to pin an omnibus image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(compose): keep two deployment files and comment out the options

The repository root held seven Compose files. Keep docker-compose.yml and
docker-compose.split.yml:

- The VA-API and NVIDIA lines, which docker-compose.vaapi.yml and
  docker-compose.nvidia.yml layered on, are commented out in both files.
- Node access is ENABLE_NODE_ACCESS, the passwords, and NODE_ACCESS_HOST in
  .env, plus two commented port lines in docker-compose.yml, in place of
  docker-compose.node-access.yml.
- A node's host runs docker-compose.yml with MODE, DATABASE_URL, REDIS_URL,
  and NODE_URL in .env, in place of docker-compose.node.yml. The image already
  turns off its bundled services for those modes. SILO_STOP_GRACE_PERIOD sets
  the longer stop timeout a draining transcode node needs.
- The development stack moves to dev/compose.yml. Its project name, and so
  its volumes, stay the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(compose): grant NET_ADMIN to Silo in the split stack too

#3280 added cap_add: [NET_ADMIN] to docker-compose.yml and the node file, so
Silo can use kernel BBR and a larger send buffer for remote clients. The
split stack's file lacked it. The regular image runs Silo as root, which
still has no NET_ADMIN unless Compose grants it, so add the same grant.
Silo's startup helper confines it there as in the omnibus image.

tcp-congestion.md names the two shipped files that grant it now that node
hosts run docker-compose.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(readme): point the multi-container update at the architecture doc

The repository holds no operator guides. Keep only what an existing install
needs before it updates (select docker-compose.split.yml, and what happens
otherwise) and link to the architecture doc; the user manual gets the full
steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(compose): run only Silo in docker-compose.yml, and make the move a manual step

docker-compose.yml kept one-shot services named postgres, redis, and
meilisearch so an update replaced the multi-container stack's containers,
and the postgres one checked for that stack before Silo started. A new
install never needs them, and they made the file look as if it still ran
PostgreSQL, Redis, and Meilisearch.

The file now runs only Silo. It does not look for an earlier install: an
install of the multi-container stack keeps its layout by selecting
docker-compose.split.yml before it updates. Started without that, Silo comes
up on a new, empty database, and the earlier containers keep running with
their data untouched until COMPOSE_FILE brings them back.

Moving such an install into the single container is a deliberate one-off:
stop the stack, then run migrate-compose-stack with docker compose run and
SILO_DATA_ROOT mounted, as docs/architecture/omnibus-image.md describes.
With nothing running it on its own, MIGRATE_COMPOSE_STACK,
REQUIRE_COMPOSE_MIGRATION, and the .compose-migration-checked marker go. A
run that finds nothing to move says so and fails. init-postgres keeps
refusing to start while a move is half done.

The Compose comments are rewritten in plainer language; no setting changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(omnibus): refuse to start empty beside an unmoved multi-container install

With the one-shot services gone, an install of the multi-container stack
that updated onto docker-compose.yml without selecting
docker-compose.split.yml came up on a new, empty database. First-run setup
was open on the published ports, and an administrator can upload plugins
that run inside the container, where the .env credentials for the earlier
postgres container, still running on the Compose network, are readable.

docker-compose.yml now mounts SILO_DATA_ROOT at /silo-data. Before
init-postgres creates a database, it looks there for the earlier stack's
cluster or Silo directories and refuses to start, naming both choices. The
check runs only while the container has no database. The manual move
command no longer needs its own mount.

Also from review:

- Restore the catalog-seeds mount the previous commit dropped from
  docker-compose.yml.
- init-config requires NODE_URL for proxy and transcode nodes, as the
  removed node file did; Silo otherwise guesses one from its port, and two
  nodes would share session keys.
- The README's note on the removed GPU and node files names the deployment
  file in use, which can be docker-compose.split.yml.
- The migration ledger cites dev/compose.yml's health check at line 142.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(omnibus): check for an unmoved install with an external database too

The earlier-install check ran only before init-postgres created a bundled
database. A DATABASE_URL in .env turns the bundled PostgreSQL off, so
init-postgres exited before the check. The multi-container Compose file
overrode that variable for Silo, while docker-compose.yml passes .env
through, so a stale URL from an earlier install could now pick Silo's
database, including an empty one that opens first-run setup.

Run the check before that exit, in the primary modes, which serve setup.
It still skips an install with a finished move or a bundled database of its
own, and proxy and transcode nodes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(compose): treat docker-compose.yml as an example and drop the startup check

docker-compose.yml is an example of a new install on the omnibus image, and
existing installs keep their own Compose file, with docker-compose.split.yml
as the earlier multi-container layout. The earlier-install check needed the
whole data root mounted beside its own subdirectories, so it goes, with the
/silo-data mount and the SILO_DATA_ROOT variable it used.

The file's header, the README, .env.example, and the architecture doc say
that the example does not look for an earlier install and comes up on a new,
empty database with setup open if started on one. The move command mounts
the data root itself again, and the doc notes that going back to the split
file after a move leaves the copy stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code impact: security Auth, privacy, or permission boundary impact: usability Core flow broken or severely blocked needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants