You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(web): direct play reads a file over parallel range connections - #4497
Other clients: Apple N/A (does not send parallel_range_origin_v1, so its plans do not change; a direct play through a proxy node stays counted on the node for up to 60 s after its last request, on every client); Android N/A (same); Roku N/A (same)
In the web app, a direct-play file is read over one HTTP connection. On a long or lossy link, one connection moves only a fraction of what the link can carry, so playback stalls while the link has spare room. This affects viewers far from the server, and the administrators who serve them. This change reads the file as several byte ranges at once, over separate connections, in the browser's decode engine. The engine plays files the browser's media element cannot take as they are. The proposal is in #4435.
Approach
The reader. A Mediabunny source keeps Mediabunny's read orchestrator, cache and prefetch profile and changes only how bytes arrive. Each read worker sends closed ranges of 2 MiB, with at most 4 in flight per source. The first 16 MiB of each read (the warm head) comes from the plan's own URL while the extra connections warm up. A range that finds the stripe URL busy goes to the plan's URL. The first answer from the stripe URL that is not a readable 206, or the first transport failure there, sends the rest of that range and every later range to the plan's URL, with no retry spent on the stripe URL. A stripe body that runs past its range moves the read to the plan's URL the same way.
The engine stripes only when the plan names a stripe URL in stream.parallel_range_url, and it uses that URL exactly as given. The server names one of three:
A proxy node serves the file: the node's own direct-play URL, the one stream.url already carries. With the default routing (playback.routing.direct_play_egress = prefer_proxy) this is the usual case on a deployment with proxy nodes, and it needs no setting.
The API serves the file: the plan's own stream, relative to the API root. The engine stripes on it only when the page loaded over HTTP/1.1, where the browser opens several connections to an origin. This needs no setting either.
The API serves the file and server.web_media_url is set: the same stream on that media origin, an https address that serves the same API over HTTP/1.1 only. It is for a deployment whose main address speaks HTTP/2.
HTTP/2 and HTTP/3 put every request to an origin on one connection, so parallel ranges there add requests and no connections. After a completed range the reader asks the browser which protocol the striped URL answered over, and returns to Mediabunny's stock UrlSource when it was HTTP/2 or HTTP/3. A browser that does not say leaves it striping. When the stripe URL is the plan's own URL (a node, or the page's origin) there is one URL: every range uses it, up to 4 at once, and a transport failure is retried there like any read's. Without a stripe URL the engine reads the plan's URL through the stock UrlSource, over one connection, as before. A plan URL that ignores Range and answers the open with the whole file also plays through the stock reader, in order. The reader wraps the prefetch profile it finds and takes the larger of its own read-ahead end and the inner profile's end, so a read-ahead change on the plain UrlSource path composes with it in either order. Mediabunny is pinned to 1.62.1 instead of ^1.62.1, because the source reads UrlSource and orchestrator internals.
The server.
New admin setting server.web_media_url: an https origin that serves the same API over HTTP/1.1 only. Empty names no media origin, and a change applies without a restart. It is named only for a client that arrived by the default access path; one that came through a network access provider gets the plan's own stream.
New client feature parallel_range_origin_v1: the client's promise to use stream.parallel_range_url exactly as given, adding no account token to it, when the plan has one, and to read stream.url otherwise. The server sets the field on an original_http plan as listed above. The two API forms carry st, which authorizes only an attempt a login session started, so only such an attempt gets them. stream.url stays valid either way.
GET, HEAD and OPTIONS on /api/v2/stream/{session_id} answer with Access-Control-Allow-Origin: *, allow the Range header and expose Content-Range, with no credentials. GET and HEAD carry these headers on every answer, refusals included, so the page can read a refusal. The preflight is answered before authentication. It carries Access-Control-Max-Age: 600 and writes no activity-log row. Authorization stays in the URL's token and st. No other route gains CORS. The API's and a node's stream answers carry Timing-Allow-Origin: *, so the reader can learn the connection's protocol.
On the native stream routes, a request from byte 0 or with no Range header writes an activity-log row, as before. A range that continues a play (it starts past byte 0) writes a row only when it fails; one that succeeds, or that the client abandons (499), writes none. A GET answered 200 keeps its row whatever its range: a progressive remux started again from its origin is a new stream. The Jellyfin stream routes still write one row per request; matching them is a possible follow-up.
On a proxy node, a direct-play session stays counted between range requests: the last request to end keeps it for the 60 s session TTL when it delivered media. A HEAD, a refusal or an unsatisfiable range adds no such hold and ends none that is running, and the session's record expires with its count. A plain hold for the session, as a remux after a replan takes, ends a running linger; while holds of both kinds overlap, the latest one decides. Without this a striped play dropped out of the node's capacity count and the admin's node-session list in every gap between ranges.
Credentials. The stripe URL always authorizes itself: st on the API forms, the token in the path of a node's URL. The player uses it as given and adds no account token, header or cookie; an earlier revision had it append the access token to a URL without st, which would have sent a login token to a node. The server never names a node's header-authorized route, and an attempt that negotiated header_authenticated_media_v1 gets no stripe URL. An attempt with no login session, such as one an API key started, gets none on the API routes. It reads stream.url, which keeps st and the token and can still rebuild an evicted session. Every other playback URL keeps the token it carries today.
The contract change is one optional field (a URL reference) and one feature name. docs/playback-api.md, docs/architecture/playback-protocol-v3.md and docs/architecture/api-contract.md describe them, and the OpenAPI document, the web types and the playback fixtures are regenerated.
The meter. The engine's throughput meter now counts the time each response was receiving, from its first body chunk to its latest, and counts overlapping time once. Bytes from parallel ranges are divided by that union, not by the sum of each range's time. The striped source counts all its ranges into one request and keeps that union as merged stretches, so a long play does not grow the list by one entry per range. A stock read stays a request of its own, so the meter's 1,000 ms rule applies to it as before.
Seeks. A seek that finds both read workers busy no longer waits for their read-ahead. At the seek, each queued read is cut to the bytes Mediabunny still waits for. When the seek's first read then finds both workers running, each older worker is cut to the bytes its waiting reads need, and its ranges that hold none of those bytes are cancelled. The older worker that owes the fewest bytes stops at once, its unmet bytes go back on the queue, and the seek's read takes its place and the first free connection. In a Node run of four seek patterns on two Matroska files over a 2 MiB/s throttled link, the wait from the last seek to its first request fell from 5.27-7.84 s to at most 0.01 s, and the first video packet came 1.04-2.72 s after the seek instead of 7.31-10.97 s. A read the replaced playback makes after the seek still counts as new. A seek whose first read asks for the same hole as a read queued before it (near the end of the file) retires a worker like any other, and the new worker takes the queued reads it covers.
HTTP/2 multiplexing was not an option, since it puts every request on the one connection this change needs to get away from. Adaptive range sizes and four fixes for faults found in a real-browser test follow in the next pull request.
The web changes add no user-visible text, and the setting has no settings-page label, so there are no silo-translations keys.
Validation
Contributor gate, Linux container, Go 1.27.4: the full chain exits 0 at e775bf9, including the database pins and the Prometheus rules test. The last commit changes only comments; its focused tests, lint, size and local-path checks pass.
The new tests drive the real Mediabunny orchestrator against a fake range server. They cover slot limits, the warm head, the fallback to the plan's URL, retries and the credential rule. On the server, they cover the plan-field gate, the setting's validation, the CORS answers and the activity-log rows per play. The meter tests cover overlapping and back-to-back responses. They do not cover a lossy link; the lab measurement on the evidence page covers one.
Seeks: the tests asked for in review hold both read workers busy on regions they still owe. "sends the seek's first range at once when each old read still waits for a cluster" checks that the seek's first request leaves within 1 s while neither old region has drained. "sends the seek's first range at once and starts no read-ahead for reads queued before it" checks the same within 100 ms after the queued reads are cut. Five more tests cover the slot a retired worker frees, cancelled ranges, a read from the replaced playback, a worker a new read waits on, and bytes after a trim. Removing any one of eleven parts of the fix, one at a time, fails a named test. Four parts have no such test: the sort and the merge of the requeued bytes, the record of the queued reads waiting at a seek, and the trim when Mediabunny restarts a queued read.
The API contract diff reports two additive changes, both on the new optional field.
Real browser: a Silo image built from the branch, Chromium, a test clip, and a media origin over HTTP/1.1. Range requests reached the media origin over three connections, each carried st and no token, and each 206 allowed the origin and exposed Content-Range. Playback reached 30 s with no alert. A seek to 70 s and then back to 50 s played on from 50 s. The play left one activity-log row on the stream route, a 206.
Maintainer review fixes at eff92e0d2a (fd99395415, 0647945ded): each new or changed test fails on d8f12d469c. On a dev deployment built from that head, Chrome on the engine route sent 148 ranges to an HTTP/1.1 media origin (up to 3 at once, each with st and no token) and 24 to the plan's URL, three seeks sent their first range within about 100 ms, a seek into the last 20 s played on, the credits Skip control worked, the play left one activity-log row, and an explicit preflight answered 204 with Access-Control-Max-Age: 600 and left no row. The maintainer's summary comment links that run's evidence page.
Maintainer rework at 83deb583f2 (afd2ef25df, 9dfa390083, a53a9bea38, faea666732, 9c10b806a6, 4b0c0693f5, b179fb9d16, a9b35d052f, bfc766b3a6, 83deb583f2): restores striping on a proxy node's URL and on the page's own origin, which round 1 had asked to remove. Each new or changed test fails on the earlier head. On a dev deployment with proxy nodes, in Chrome on the engine route (the node runs on a build of 83deb583f2, the API-served runs on 9c10b806a6): through a node over HTTP/2 the reader sent a few ranges and returned to the stock reader (19 requests); through a node over HTTP/1.1 it striped for the whole play (164 closed ranges, up to 4 in flight, no account token), and the node listed the session during play and 30 s after the browser closed, and not at 75 s; API-served over HTTP/1.1 it striped on the page's origin (164 ranges, one activity-log row); API-served over HTTP/2 it used the stock reader (19 requests); with a media origin it striped there (132 ranges with st and no token). Three seeks worked in every run. The maintainer's summary comment links that run's evidence page.
Surface and build: web player, browser engine route. The page names the build of each result. It holds the first round's gate, Chromium request lists and a lab measurement of startup, stalls and throughput against the single-connection reader on a 350 ms, 1% loss link; its h1 cell measured the same-origin rule this round removes. Its last section holds this round's gate, the browser request list with the seek check, and the Node seek table.
Risks
More requests. Ranges are 2 MiB here, so a long play makes many requests. The next pull request makes them larger.
CORS. The stream route answers with a wildcard origin and no credentials. Authorization is unchanged: the token and st in the URL.
On by default. A node-served play and an API-served play on an HTTP/1.1 page stripe with no setting. An API-served range runs the full stream path (authorization lookups and two log lines); a node's token route does not. The HTTP/2 check keeps the extra requests off connections that would not gain from them, in browsers that report the protocol.
Node capacity. A stopped direct play through a proxy node counts against the node's max_jobs, and shows in the admin's node-session list, for up to 60 s after its last request. That is the reason for the Validation tasks: line: Distributed transcode nodes — Server #1177 C2 and C3 and Distributed transcode nodes — Web admin #1178 C2 should be walked again. The planner's own admission has older gaps this does not close (it drops a reservation when a newer health report arrives, and reservations are per API server).
Media origin down or misrouted. The first refusal (any answer that is not a readable 206) or transport failure sends the read to the plan's URL, so playback continues at single-connection speed.
Backup and restore.server.web_media_url is classed as a server-specific setting, so a restore onto another server does not carry it.
Seek costs. A cancelled range can close its HTTP/1.1 connection, so the next range pays a new handshake. During rapid seeks a retired worker's unmet bytes can be read twice: 2.38 MiB and 8.75 MiB in the two rapid-seek runs. A worker that serves the new playback counts as older between its reads, so a later read can retire it and its read-ahead is fetched again. Keeping it instead delayed the next new read from 0.1 s to 3.1 s in a fake-clock test.
Dependency pin. Mediabunny cannot float to a newer minor version without a check of the internals the source reads.
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 how I checked a change nobody sees.
Adversarial review: Two reviewers on different models (claude-opus-5-5 in Claude Code, gpt-6.1-sol in Codex CLI) read the change twice, on the rebased branch and on the finished stack, and a claude-sonnet-5-5 seat merged each pair's findings. They ran mutation checks on the tests they relied on. The first round found two High defects in the lingering session hold, and both were fixed and re-run. The second found a Medium defect, a failing media origin failed the read instead of falling back to the plan's URL, and a few documentation and comment errors. All were fixed and checked by a separate claude-sonnet-5-5 seat. For the maintainers' second round, a gpt-6.1-sol seat reviewed the plan before any code was written, the same two-model pair reviewed the result (one Low finding, fixed), and a separate claude-sonnet-5-5 seat checked each change against the code. The seek fix went through the same steps: the pair compared designs and reviewed the plan, then reviewed the result (three Low comment findings, fixed), and a separate seat checked the change against the plan. The maintainer's review fixes and rework (fd99395415, 0647945ded, 3c4b1edc2b, and the commits from afd2ef25df to 83deb583f2) were written in Claude Code with claude-fable-5-2. gpt-6.2-sol and claude-opus-5-5 reviewed the fix plan first; gpt-6.2-astra, gemini-4-neon and an independent claude-fable-5-2 reviewed the design of the proxy-node rework before it was written, and each changed it.
Note
Add parallel range connections for direct play of original files
Adds the parallel_range_origin_v1 playback feature and optional stream.parallel_range_url. The server publishes it for eligible original-HTTP deliveries (playback_v3.go), and the web player reads the file through a new ParallelRangeSource that stripes requests over the plan URL and optional stripe URL (parallelRangeSource.ts).
Adds CORS and Timing-Allow-Origin handling for the original-file stream route, including unauthenticated OPTIONS preflights (playback_delivery.go).
Adds nodesessions.Tracker.HoldLingering, which keeps a direct-play session alive across the gaps between striped range requests when at least one request delivered media (tracker.go).
Reworks media-data metering: createMeteredFetch reports merged receiving-time spans, and throughput now uses unioned receiving time instead of each request's full first-to-last interval (mediaFetch.ts, media-data-meter.ts).
Adds the server.web_media_url admin setting (bare HTTPS origin) and a new stream-path filter that omits range-continuation and preflight requests from activity logging.
Behavioral Change: mediabunny is now pinned to exactly 1.62.1 because ParallelRangeSource depends on Mediabunny internals (mediabunnyInternals.ts); upgrading requires re-checking that internal surface. MediaDataMeter.throughputKbps changes how throughput is computed for striped reads.
One HTTP connection to a long, lossy link moves a fraction of what the
link can carry, so web direct play stalled where the link had room. The
web player now reads the file as several closed ranges at once, through
a Mediabunny source that keeps its read orchestrator, cache and prefetch
profile and changes only how the bytes arrive. mediabunny is pinned to
an exact version because the source relies on UrlSource internals.
The first bytes of each read come from the plan's own URL while the
extra connections warm up, and a range that finds the stripe URL busy
falls back to the plan's URL. The first 5xx answer or transport failure
(fetch, body read, early end) on the stripe URL does the same for the
rest of that range and every later range, with no retry spent on the
stripe URL. The player stripes on, in order:
- stream.parallel_range_url, when the plan carries it;
- the page's own origin, when the page came over HTTP/1.1;
- a proxy node's absolute URL, as issued.
The stream reference in parallel_range_url (st) authorizes each range on
its own, so the player sends no account token to the media origin. It
adds its access token only to a parallel_range_url that has no st, and
never to a proxy node.
Server side:
- New admin setting server.web_media_url: an https origin that serves
the same API over HTTP/1.1 only. Empty is off, and a change applies
without restart.
- The client feature parallel_range_origin_v1 is the client's promise to
read the file from stream.parallel_range_url when the plan has one,
and from stream.url otherwise. Only then, and only for an attempt that
a login session started, does an API-served original_http plan carry
stream.parallel_range_url. An attempt with no login session, such as
one an API key started, keeps stream.url, where st plus the account
token still rebuild an evicted session. stream.url stays valid in
either case, so the client may also read the warm head, overflow
ranges, or a natively played file from it.
- GET, HEAD and OPTIONS on /api/v2/stream/{session_id} answer with
Access-Control-Allow-Origin: *, allow the Range header and expose
Content-Range, with no credentials. GET and HEAD carry them on every
answer, authorization refusals included, so the page can read the
refusal. The preflight is answered before authentication, and
authorization stays in the URL's token and st. No other route gains
CORS.
- nodesessions.Tracker.HoldLingering keeps a direct-play session counted
for sessionTTL after its last range request ends, so the gap between
ranges no longer ends the session.
Signed-off-by: Anagh Kumar Baranwal <[email protected]>
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The change adds negotiated parallel range playback for eligible plans. It also updates original-file stream CORS handling and direct-play session retention. The browser now selects a parallel range reader when the URL is available.
The protocol adds the parallel_range_origin_v1 feature and optional parallel_range_url. Admin settings add server.web_media_url, validated as an optional HTTPS origin. Fixtures and documentation describe when the URL is available and how clients authorize range requests.
Playback start and replan set the parallel URL when the attempt, feature, delivery path, and media-origin conditions are met. Direct-play session holds use lingering release behavior, which retains session records until a later touch or expiry.
The original-file stream route receives cross-origin handling. Matching OPTIONS requests return 204 with wildcard origin and allowed range headers before authentication. Tests and docs distinguish stream behavior from HLS and subtitle routes.
Browser routing and parallel range reads web/src/player/components/VideoPlayer.tsx, web/src/player/engine/*, web/src/player/stream-url.ts, web/src/player/stream-url.test.ts, web/package.json
The player passes the access token and navigation protocol into route selection. The worker selects ParallelRangeSource when a parallel URL is available; the source schedules concurrent ranges, validates responses, meters data, and applies URL fallback and retry rules. The mediabunny version is pinned to 1.62.1.
sequenceDiagram
participant VideoPlayer
participant PlaybackV3
participant resolveOriginalPlaybackRoute
participant ParallelRangeSource
participant APIStreamRoute
VideoPlayer->>PlaybackV3: Request playback plan with negotiated feature
PlaybackV3-->>VideoPlayer: Return parallel_range_url when eligible
VideoPlayer->>resolveOriginalPlaybackRoute: Pass stream URL, access token, and navigation protocol
resolveOriginalPlaybackRoute-->>VideoPlayer: Provide selected parallel range URL
VideoPlayer->>ParallelRangeSource: Open source with plan URL and parallel URL
ParallelRangeSource->>APIStreamRoute: Request byte ranges
APIStreamRoute-->>ParallelRangeSource: Return ranged media responses
Loading
Possibly related issues
Silo-Server/silo-server#4439: The issue describes the parallel-range playback feature, media-origin setting, negotiated feature, stream URL field, stream-route CORS behavior, and lingering session hold implemented here.
Suggested reviewers:quick104, blurbery, rhainland
Merge Risk: Moderate · up to fbfb6
Parallel range playback works on the happy path and falls back to the normal stream URL in most failure cases. Several edge cases remain: seeking can fail on a healthy link while prefetch is running, a server that ignores range requests can fail playback startup, and a malformed oversized stripe response fails a read instead of falling back. Resolve at least the seek and whole-file-response cases before wide enablement.
Security architecture risk: Minimal · up to fbfb6
The reviewed paths preserve playback authorization and bound parallel requests and session retention. No introduced material security or ownership failure was established. The configured media origin must be trusted with playback credentials and, when a stream reference is unavailable, the viewer’s account access token.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The configured media origin is credential-trusted API ingress, not an untrusted delivery node. It receives the stream reference when available and the viewer’s account access token when the URL lacks st. That fallback has the account token’s authority, potentially including administrator authority, rather than only one stream’s scope. Ordinary absolute proxy URLs do not receive the added account token.
Trust Boundaries and Controls
observed — The existing stream-reference authorization checks signature and expiry, media purpose, path-session binding, live playback, account/profile ownership, and active initiating login. Viewer authorization still follows. These controls predate this PR and remain on the newly cross-origin-readable GET and HEAD routes; the preflight response does not grant media access.
Resilience and Maintainability Implications
observed — Worker termination aborts outstanding ranges and removes queue ownership. Each range releases its slot on completion or failure, and stripe signal cleanup clears timers and listeners. A regression test explicitly checks disposal of all in-flight requests, although it was not executed and the inherited disposal implementation was not inspected.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(web): direct play reads a file over parallel range connections" matches the main change. The changeset adds ParallelRangeSource, which reads a direct-play file through concurrent byte-…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is detailed and directly describes the changeset: parallel byte-range reads for direct-play original files in the web player, the new parallel_range_origin_v1 feature and parallel_rang…
Full details: Title check
Explanation
The title "feat(web): direct play reads a file over parallel range connections" matches the main change. The changeset adds ParallelRangeSource, which reads a direct-play file through concurrent byte-range requests in the web player, plus the supporting server feature and setting.
Full details: Description check
Explanation
The description is detailed and directly describes the changeset: parallel byte-range reads for direct-play original files in the web player, the new parallel_range_origin_v1 feature and parallel_range_url field, the server.web_media_url setting, CORS handling for the stream route, the Mediabunny pin, the lingering node session hold, and the metering and seek changes. It is clearly related to the changes and is not off-topic or generic.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Cross-origin media preflight rejects header-authenticated playback
Clients negotiating header_authenticated_media_v1 and parallel_range_origin_v1 receive a media-origin URL without st, but preflight rejects their required Authorization header. Allow the authentication and profile headers required by header-authenticated media.
Prompt for LLM
File internal/apiv2/playback_delivery.go, line 105:
Cross-origin media preflight rejects header-authenticated playback
A client negotiating both `header_authenticated_media_v1` and `parallel_range_origin_v1` receives a media-origin URL without `st`, but its required `Authorization` header fails this preflight because only `Range` is allowed. Allow the authentication and profile headers required by header-authenticated media in the preflight response.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed for a client that negotiates both header_authenticated_media_v1 and parallel_range_origin_v1: a start with both features returns parallel_range_url with no st, and the preflight allows only Range. The first-party web app never negotiates header-authenticated media, so it does not reach this. How the two features should combine is a contract question for the maintainers, so nothing changes here yet.
The reason will be displayed to describe this comment to others. Learn more.
The confirmed issue affects clients that negotiate both features, though not the current first-party web app. The fix depends on the maintainers’ decision about how the features should interact.
Would you like me to create an issue to track that decision and the preflight incompatibility?
The reason will be displayed to describe this comment to others. Learn more.
Completed read workers remain retained in the abort controller map
Seeks and successive worker runs retain workers and controllers in _abortControllers until the source is disposed. Delete each worker's entry in finally after aborting its outstanding ranges.
Prompt for LLM
File web/src/player/engine/parallelRangeSource.ts, lines 227-228:
Completed read workers remain retained in the abort controller map
Every worker run inserts its worker and controller into `_abortControllers`, but the `finally` block never removes the entry, so seeks and successive worker runs retain those objects until the source is disposed. Delete the worker's entry in `finally` after aborting its outstanding ranges.
The reason will be displayed to describe this comment to others. Learn more.
Not a leak. Stock UrlSource._runWorker does not delete its entry on a normal exit either: the parent constructor passes onIdleWorkerRemoved: worker => this._abortControllers.delete(worker) to the orchestrator, and the subclass inherits it. With Mediabunny's two workers the map stays at two entries; after reads into six separate regions its size was 2.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction. The inherited onIdleWorkerRemoved callback handles cleanup, and the observed map size of two after reads across six regions supports that the entries are bounded by the worker count.
I withdraw the leak suggestion; deleting the entry in finally is not necessary on the evidence provided.
Main pruned tests next to the ones this branch adds. The branch's tests
are kept; routing.test.ts, which main removed, now holds only the
stripe URL cases.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Exercise the published alternate URL in the signed-range test.
The test checks the prefix of ParallelRangeURL but sends its GET to plan.Stream.URL. Pass the alternate URL to the fixture and route its path and query without adding a second /api/v2 prefix. Then the 206 assertion verifies that the URL the browser receives works without an account token.
Test the Redis deadline before replacing the lingering record.
The preceding Touch removes the lingering record. This assertion then checks only the local count for a normal touch. Add a case that leaves the direct-play record in lingering and advances a TTL-aware Redis fixture through a refresh just before expiry. Check that the key is present during the grace period and absent once the release deadline passes.
Use the final retry test to cover recovery on the plan URL.
The fault occurs on the first stripe, so this test exercises origin fallback again. It never proves that a plan-URL body failure can spend one retry and complete from the correct offset. Inject the fault on the plan URL after a partial body, then assert the retry callback count, the exact resumed offset, and the final bytes. Keep the table above for stripe fallback.
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: c34cf27b-0a17-4737-bb6d-c166be1882fb
Commits
Reviewing files that changed from the base of the PR and between 081e2ed and f790878.
Files ignored due to path filters: 1
web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Distinguish media authorization from CORS preflight.
OPTIONS does not authorize playback. GET and HEAD can still use the Authorization header, and header-authenticated plans require that header and the profile selector. State that this preflight permits only Range, and describe st and token as query-based authorization options rather than the only supported credentials. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Confirmed for a client that negotiates both header_authenticated_media_v1 and parallel_range_origin_v1: a start with both features returns parallel_range_url with no st, and the preflight allows only Range. The first-party web app never negotiates header-authenticated media, so it does not reach this. How the two features should combine is a contract question for the maintainers, so nothing changes here yet.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Include OPTIONS in the stream route’s Allow header.
The middleware answers OPTIONS with 204, but a POST to the same stream URL returns 405 with Allow: GET, HEAD. The registry does not know about the middleware-only method. Include OPTIONS for the stream path when constructing Allow. Keep the header unchanged for subtitle and HLS routes. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Correct, and cosmetic: the 405 Allow header comes from the operation registry, which has no entry for the middleware's OPTIONS. No client reads it to decide anything, so this stays as it is.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Validate the file version with the strong ETag.
If a file is replaced by a same-length file whose modification time falls in the same HTTP second, both responses pass the current checks. The reader then supplies bytes from two file versions as one stream. ServeDirectPlay already sends a strong ETag where available, and both media routes expose it to the browser. Compare it before delivering later range bytes. If the source cannot establish a shared strong validator, do not append those bytes to the existing stream. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Plausible, low. The reader's size and Last-Modified check is already stricter than the stock source, which checks nothing across requests. A strong ETag would be stricter still, but on Linux the validator includes device and inode, so two nodes that mount the same library differently would fail a healthy play. Not changed here.
#!/bin/bash
fd -g 'directplay_revision_linux.go' internal/playback --exec sh -c 'ast-grep outline "$1" --items all; cat -n "$1"' sh {}
ast-grep outline internal/playback/directplay_etag.go --items all
cat -n internal/playback/directplay_etag.go | sed -n '1,60p'
cat -n internal/playback/directplay.go | sed -n '90,130p'
Length of output: 3807
@Quick104 Thanks for the correction. I overlooked that the Linux direct-play ETag includes the device and inode. The same file can therefore have different ETags across nodes, so I withdraw my recommendation to require matching ETags across those routes.
The same-length replacement risk remains, but I understand the decision to leave it unchanged. I’m not marking the finding as addressed.
Learnings added
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 4497
File: web/src/player/engine/parallelRangeSource.ts:477-484
Timestamp: 2026-11-18T16:03:13.938Z
Learning: Within repository "Silo-Server/silo-server", only for files matching one of ["web/src/player/engine/parallelRangeSource.ts"]: In web/src/player/engine/parallelRangeSource.ts, ranges can come from different nodes. The Linux direct-play ETag includes the file's device and inode, so nodes that mount the same library differently can return different ETags for the same file. Do not require unconditional ETag equality across routes without a validator shared across nodes. Size and Last-Modified checks still leave a same-length replacement within one HTTP second undetected.
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: CLAUDE.md:0-0
Timestamp: 2026-11-12T19:04:00.627Z
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. The 1.0 feature set is essentially complete;
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-11-17T15:42:21.993Z
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.
The reason will be displayed to describe this comment to others. Learn more.
Review of feb711e644 (the PR's commit plus a merge of main, which I pushed to resolve the conflicts with the test prune in #4465). Six findings are inline. Three I'm fixing on this branch; three need a maintainer decision and are not requests to the author.
One more finding has no single line:
Medium, maintainer decision: each 2 MiB range pays the full request path. Traced from source, not measured: a range request on the media origin runs four Postgres round trips (attempt identity, login session, viewer access, media file row), three rate-limiter calls, a stat and open, and writes one activity_log row, because isStreamChunk in internal/activitylog/middleware.go treats /stream/{session_id} as a session start. A 40 GB file is about 19,000 requests, so about 76,000 round trips and 19,000 activity rows for one play. The stock reader makes far fewer requests at the same per-request cost. The default rate limits are not reached by one viewer (about 60 requests per second at 1 Gbit/s against 120 per second per address). The open question is whether this lands with 2 MiB ranges, or waits for the larger ranges planned for the next pull request, a cheaper path for range requests, or both.
Checked and not findings: the abort-controller map is bounded at two entries by Mediabunny's idle-worker eviction, as in the stock source; Last-Modified is exposed on both the API and proxy stream routes; plan.stream.headers is always empty for web plans; the lingering record cannot leak or outlive its TTL (package tests pass under -race, plus a concurrent hold, touch and refresh run); a lingering record does not count against a user's stream limit or block a node drain.
The reason will be displayed to describe this comment to others. Learn more.
Medium: a request that delivers nothing holds node capacity for a minute.HoldLingering is taken for every request on this route, so a HEAD probe, a 404 or a 416 keeps the session in ActiveCount() for 60 s after it ends. /health reports that count as active jobs and the planner checks it against max_jobs, so with the health poll a proxy with max_jobs of 1 is skipped for up to about 90 s. The Redis record lasts 90 to 120 s, so the admin node-sessions view shows a stopped play as live for that long; nothing on the proxy removes the record when the API ends the session. Measured with the tracker's tests: the count is 1 at 59 s and 0 at 61 s, and no DEL is sent. Repair for the first part: HEAD takes the plain hold. I'm making that change on this branch. Whether an error answer should linger, and whether the admin view may show a stopped play for up to two minutes (validation #1178 C2; #1177 covers worker capacity and removal), is a maintainer decision.
The reason will be displayed to describe this comment to others. Learn more.
The HEAD part is fixed in 5a25499: a HEAD takes no hold. I used no hold instead of the plain hold I named above, because a plain hold's release would end a session that is lingering. Error answers still linger, and the record's lifetime is unchanged; both stay open for the maintainers.
The reason will be displayed to describe this comment to others. Learn more.
Medium, maintainer decision: the 32 MiB floor can hold up a seek. The floor applies to every prefetch call, including the MKV cue read and each seek target. Mediabunny runs two workers and does not retarget a running one: a third read queues until a worker reaches its target. With both workers busy on 32 MiB regions, a seek's first request waits for one of them to finish (reproduced against the real orchestrator: the seek's first request went out only after both regions reached the full floor). On a 20 Mbit/s link that is several seconds before the seek asks for a byte. The author's note on #4435 says the next pull request limits the floor to the warm head and sequential reads. The open question is whether that condition should land here instead.
The reason will be displayed to describe this comment to others. Learn more.
Medium, maintainer decision: the throughput the page learns includes the gaps between ranges. A run reports one first-to-last interval for every response of a worker run, so time spent waiting for a slot or for an in-order range counts as receiving time. Two 2 MiB responses that each took a second, a minute apart, report about 550 kbit/s. The page uses this rate for Auto quality and plan telemetry, so a striped play on a fast link can read as slow. #4435 lists this as a fault the next pull request fixes. The open question is whether this pull request can land with the meter under-reading.
The reason will be displayed to describe this comment to others. Learn more.
Maintainer decision: these two rules turn the reader on with no setting.#4439 was accepted as off by default; the author's later comment there says so. On a page loaded over HTTP/1.1, media goes from at most 2 to at most 4 of the browser's 6 connections to the origin, and progress, subtitle, font and trickplay requests share what is left. A proxy node's URL is striped whatever protocol the node speaks, so behind HTTP/2 the ranges share one connection and only the request count grows. Neither case has a measurement on the evidence page. The options are to keep both, or to stripe only when the plan names a media origin.
The reason will be displayed to describe this comment to others. Learn more.
@darthShadow the maintainers are reversing two parts of the round-1 direction, and the error was ours, not yours. Asking you to stripe only when the plan names a media origin, and to drop the proxy-node rule and the node session hold, left the feature doing nothing on a deployment with proxy nodes: the default playback.routing.direct_play_egress is prefer_proxy, so direct play goes through a node and the plan never names a stripe URL. Your first version handled that case, and your correction on #4439 said so.
We are restoring your original three cases on this branch ourselves, so please hold pushes to it until we say it is done:
A media origin (server.web_media_url), as now.
The page's own origin when the page loaded over HTTP/1.1.
A proxy node's own URL.
Three things will differ from the first version, each from a defect we verified:
The server names the stripe URL in stream.parallel_range_url for all three cases, and the client uses it exactly as given and never adds a token. Today's rule (append the account token when the URL has no st) would send a login token to a node whose URL is ever published there, and a rule based on the URL's shape cannot tell a node's token route from its header-authorized route.
The node session hold comes back, but only a request that delivered media lingers, and the session's record expires with its count.
The media origin is not given to a client that reached the server over a network access provider.
Nothing here needs work from you. We will post the result and the evidence when it is pushed.
The reason will be displayed to describe this comment to others. Learn more.
Done, at 8bf61576e1. All three of your original cases stripe again, and the summary comment has the details and the live results. Two things you may want to know before the follow-up:
The server now names the stripe URL for every case, and the client no longer has a rule based on the URL's shape or adds a token. For a node it is the same URL as stream.url.
The reader returns to the stock UrlSource when the browser reports HTTP/2 or HTTP/3 for the striped URL. Our dev deployment's nodes answer over HTTP/2, and the first build sent 165 ranges down one connection there.
The branch is yours again. Thank you for building the proxy-node case in the first place.
…ed bodies
Review fixes for the parallel range reader:
- Any answer from the stripe URL that is not a readable 206 moves the
read to the plan's URL, as a 5xx already did. A 4xx from the media
origin no longer fails a read the plan's URL can serve.
- A response that delivered bytes restarts the retry count, and a body
from the plan's URL that ends early after sending bytes is asked for
again with no retry, as the stock source does.
- A HEAD on a proxy node's direct-play route takes no session hold, so a
probe does not count against the node's capacity for a minute.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
url.Parse accepts any digits as a port, so server.web_media_url could
store https://host:65536. The web player parses that origin before it
plays anything, and the parse error stopped playback of the plan's own
URL too.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Reviewed head: 83deb583f2. This replaces the earlier summary. The maintainers reversed part of the round-1 direction and reworked the branch themselves; nothing here is a request to the author.
Fit: 8/10 · Readiness: 7/10 — conditional (assuming CI is green)
Fit. The feature now works where direct play goes through proxy nodes, which is the default routing, and on a single node whose page loads over HTTP/1.1, with no setting. It stays at 8 because it adds a contract field and a feature name during the 1.0 polish period, and the media-origin setting has no field in web admin.
Readiness. Every case was checked live in Chrome. It stays at 7 for the open items below and because Safari and Firefox are unchecked.
What round 1 got wrong
Round 1 asked for striping only when the plan names a media origin, and for the proxy-node rule and the node session hold to go. With the default playback.routing.direct_play_egress (prefer_proxy) a node serves direct play, so the feature then did nothing on a deployment with proxy nodes. The author's first version handled that case, and his correction on #4439 said so. The rework restores his three cases.
Changed on this branch since 717a117603
9dfa390083: the server names the stripe URL in stream.parallel_range_url for all three cases: a proxy node's own direct-play URL, the plan's own stream, or the same stream on server.web_media_url. The URL always authorizes itself. The client uses it as given and never adds an account token; the earlier rule (append the token when the URL has no st) would have sent a login token to a node. The media origin is not named for a client that arrived through a network access provider. The field's format is uri-reference.
a53a9bea38: the web player stripes on a node's URL as issued, and on the plan's own stream when the page loaded over HTTP/1.1. With one URL there is no second origin to fall back from, so a transport failure is retried there.
faea666732, 9c10b806a6, 4b0c0693f5: after a completed range the reader asks the browser which protocol the striped URL answered over, and returns to the stock reader on HTTP/2 or HTTP/3, which then keeps its own read-ahead. The dev deployment's nodes answer over HTTP/2, where the first build sent 165 ranges down one connection; the play now makes 19 requests. The stream answers carry Timing-Allow-Origin: * for this.
afd2ef25df, b179fb9d16, a9b35d052f, bfc766b3a6, 83deb583f2: the node session hold is back, changed from the first version: only a request that delivered media lingers, the session's record expires with its count, the latest hold decides whether the session is a direct play or another transport (a remux ends the linger), and the last writes are bounded, detached from the request and serialized with new registrations.
da6f28b76d: two helpers moved to rangeRequest.ts to keep the reader under the 800-line limit.
Earlier fixes (0647945ded, fd99395415, 3c4b1edc2b) are unchanged. Each new or changed test fails on the head before its change.
Left for the maintainers
A forward seek inside the read-ahead window reads the bytes in between first. Mediabunny attaches a read that starts inside a running worker's 32 MiB target to that worker, so the seek rules never run. Narrowing the read-ahead floor, as the author describes for the follow-up, shrinks the window.
Each API-served range runs the full stream path: the authorization lookups and two info-level log lines. With striping on by default for an HTTP/1.1 page this now applies without a setting. Larger ranges in the follow-up reduce it. A node's token route does none of this.
Node admission has older gaps this does not close. The planner drops a reservation when a newer health report arrives, and reservations live in each API server's memory. The hold narrows the gap between ranges; it does not make max_jobs exact.
After a media-origin failure the reader keeps 2 MiB ranges on the plan's URL for the rest of the play. The code documents this as intended.
Smaller points from the last cross-provider review, not changed: a retried start that replays its stored decision can carry the media origin to a client that has since moved to a network access provider; a seek-scoped replan keeps the attempt's stored feature list, so it can still name a stripe URL after the client dropped the feature from that request; the stock reader that takes over after an HTTP/2 report does not re-check the file's size and Last-Modified, as it does not on main; and on the page's own origin the striped requests carry the account token the plan's URL always carries.
The web admin field for server.web_media_url has no pull request yet.
Validated features
Validation tasks: changes #1177 C2, C3; changes #1178 C2. A direct play through a proxy node stays in the node's job count and in the admin's node-session list for up to 60 s after its last request. That is a deliberate change: without it a striped play left both in every gap between ranges. Those three cases should be walked again. Manual seeking and the credits Skip control (#1149 C1, C2) were rechecked on the engine route through a node and work. Chapter navigation (#1156 C2) was not rechecked.
Validation status
Web: 784 player tests, typecheck and lint pass. Go: the touched packages pass, the node tracker's under the race detector; the contract diff shows two additive changes. The Go changed-lines lint reports no issues.
Live, on a dev deployment with proxy nodes, in Chrome on the engine route with a 3.46 GB Matroska file. The two node runs are on a build of the head; the three API-served runs are on 9c10b806a6, before the last hand-off and node-tracker changes:
through a node over HTTP/2, no setting changed: a few ranges, then the stock reader; 19 requests;
through a node over HTTP/1.1, no setting changed: 164 closed ranges on the node, up to 4 in flight, no account token; the node listed the session during play and 30 s after the browser closed, and not at 75 s;
API-served over HTTP/1.1: 164 ranges on the page's origin, up to 4 in flight, one activity-log row;
API-served over HTTP/2: the stock reader, 19 requests;
API-served with an HTTP/1.1 media origin: 132 ranges there with st and no token, 29 on the plan's URL.
Three seeks worked in every run, and no run logged a console error.
Not checked live: any gain in throughput (the lossy-link measurement is the author's), a second play admitted at max_jobs 1, Safari and Firefox, and a remux restarted by a mid-file range.
Review method: finder, validation and verifier passes on d8f12d469c; a plan review by gpt-6.2-sol and claude-opus-5-5 before the first fixes; a gpt-6.2-sol review of those fixes; design reviews of the proxy-node rework by gpt-6.2-astra, gemini-4-neon and an independent claude-fable-5-2 before it was written, each of which changed it. A gpt-6.2-sol review of the rework at 8bf61576e1 returned eleven findings: four are fixed (4b0c0693f5, b179fb9d16), one concerned a preview build and does not apply to anything released, and the rest are in item 6 or were judged not to change behaviour from main. Kody's ten comments on the node tracker are fixed or answered in their threads, and its review of 83deb583f2 raised nothing new.
User manual: Document the web media address setting (server.web_media_url) siloserver.org#405 already describes the three cases. It should also say that the web app goes back to one connection when the address answers over HTTP/2 or HTTP/3, that a proxy node lists a direct play for up to a minute after it stops, and that the media origin is not used by a client on a network access provider.
Other clients: Apple, Android and Roku do not send the feature and their plans do not change. The node session hold and the activity-log rule reach every client's direct play.
Check that a new replan drops the alternate after the setting is cleared.
The test leaves server.web_media_url unchanged between start and replan. It would pass if the replan reused the stored alternate URL. In one case, start with a configured origin, clear it before the replan, then assert that the new plan has no ParallelRangeURL and still has its signed Stream.URL.
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: 484ab3cd-6988-47f8-a255-b07c2430da13
Commits
Reviewing files that changed from the base of the PR and between f790878 and feb711e.
Files ignored due to path filters: 1
web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 9
contracts/api/v2/openapi.json
internal/api/handlers/playback_v3.go
internal/api/handlers/playback_v3_test.go
internal/apiv2/playback_delivery.go
internal/apiv2/playback_delivery_test.go
internal/config/admin_settings.go
internal/config/admin_settings_test.go
web/src/api/v2/schema.ts
web/src/player/engine/routing.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Maintainability & Code Quality · Quick win
Clarify that settings changes apply to new decisions, not replays.
If an admin clears the setting after a successful start, a retry with the same attempt ID still returns the stored parallel URL. This matches the protocol's verbatim replay rule. Change the comment to say that new start and replan decisions read the current setting without a restart. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Correct: a retried start with the same attempt replays the stored decision, so a cleared setting applies to new start and replan decisions. The comment's wording is left for the maintainers with the other contract text; behavior does not change.
url.Parse puts ":443" in Host for https://:443, so the setting stored
an origin a browser cannot parse.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
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: fb54027b-e25a-43ac-9304-49fdca007b99
Commits
Reviewing files that changed from the base of the PR and between feb711e and f6bbb81.
Files selected for processing: 5
internal/config/admin_settings.go
internal/config/admin_settings_test.go
internal/proxy/server.go
web/src/player/engine/parallelRangeSource.test.ts
web/src/player/engine/parallelRangeSource.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Stability & Availability · Heavy lift
Do not retain a session after a GET that serves no media.
If the file disappears after the proxy issues a valid direct-play URL, ServeDirectPlay returns 404 without sending media. The old plain hold ended on return. The new HoldLingering release counts that failed request in /health for another 60 seconds. On a capped proxy, that count can occupy a slot even though no transfer started. (raw.githubusercontent.com)
Track the request while it runs, but establish or extend the lingering session only after it serves media. A failed request must not erase a linger established by a successful overlapping range.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and already open for the maintainers in the earlier thread on this line: an error answer still lingers. The repair needs the release to know whether media was served, which changes the tracker's interface, so it waits for their call on the hold as a whole.
…ries after a short body
A stripe answer whose Content-Range does not name the range and the
file's size now moves the read to the plan's URL, like a missing one. A
short body from the plan's URL that delivered bytes restarts the retry
count, as a body error after bytes already did. The test file's byte
pattern no longer repeats every 64 KiB, so a duplicated or misplaced
chunk fails the comparison.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Thanks for the review and for the fixes. 5a25499 covers the three findings you took: a stripe answer that is not a readable 206 now moves the read to the plan's URL, a response that delivered bytes restarts the retry count, and a HEAD on the proxy route takes no hold. Thanks for a4dd535 and f6bbb81 too.
What I'll push to this branch:
The PR body: Approach and Risks still say only a 5xx or a transport failure moves the read to the plan's URL. Validation tasks: gains changes #1177 C2, C3 for the lingering hold.
Item 4: the server leaves out parallel_range_url when the plan uses header_authenticated_media_v1, so every published parallel URL carries st and the schema and comments stay true.
The stripe fix checks only that Content-Range is present. A stripe 206 whose Content-Range names other bytes or another size still fails the read with no fallback (parallelRangeSource.ts:362 and :472-482). It will fall back too.
A stripe that goes silent without closing gets an inactivity deadline under the page's 20 s stall timeout, and then falls back like any other stripe failure.
The CodeRabbit threads on the schema wording for a URL without st, the replan wording, OPTIONS in Allow on a 405, and a media origin that new URL() cannot parse.
On the other items for the maintainers:
1. No setting. The follow-up pull request (not open yet) keeps the three rules and makes rule 2 start on repeat visits too, so it widens rule 2's reach. The evidence page has one measurement of rule 2: the h1 cell, where the page and the media use HTTP/1.1 on one origin with no setting. There, median stalls went from 374 to 0 and throughput from 31.4 to 43.6 Mbit/s. It doesn't measure what the page's other requests get while media uses up to 4 of the 6 connections, and rule 3 has no measurement. The options:
Keep rules 2 and 3. A deployment that serves the page over HTTP/1.1 gets the h1 result with no setting. The costs are the unmeasured connection share on that page, and more requests to proxy nodes, including nodes behind HTTP/2, where striping adds requests and no connections.
Either one is a small change in parallelRangeUrlFor (routing.ts:85-97), and I'll make whichever you pick.
2. The seek delay and the meter. The follow-up fixes the meter: each response records one span, from its first body chunk to its latest, and the meter divides bytes by the union of those spans. For seeks, it applies the 32 MiB floor only while the warm head is open, or to a read that follows a worker forward by a full range; a cue lookup and a seek's reads keep Mediabunny's own prefetch. It does not stop a worker that is already running, so a seek that arrives while both workers still run toward targets set under the floor still waits for one of them. I read that from the code and have not run it. If you want either change here, I'll move it.
3. Range cost. The follow-up changes the range sizes, not the server path. After its 16 MiB warm head, each read worker sends 2 MiB, then 4 MiB, then 8 MiB ranges, and 8 MiB from then on. Chromium request counts for one test clip of about 49 MB:
an early build of this PR: 27 stream requests, 23 to the media origin and 4 to the plan's URL;
this PR before your commits: 22 media-origin ranges over 3 connections;
the follow-up: 8 stream requests, 6 to the media origin and 2 to the plan's URL, over 2 connections.
The evidence has no count for the stock reader. Neither pull request makes a range request cheaper on the server: each one still runs the full stream path, and isStreamChunk still logs it as a session start.
5. Web admin field. I can add a field for server.web_media_url in this pull request, or in a follow-up, if you want one before it ships.
6. The lingering hold. Nothing in either pull request covers it yet. CodeRabbit's comments 4616542103 and 4616542064 concern the same window. If you shorten it, one change covers both: the refresh writes a lingering session's record with SET and the time left until its deadline, in place of EXPIRE.
Two things in your list are already on the branch, so they need no work from you:
The PR body's Approach and Risks sentences were updated after 5a25499a4e to say any answer that is not a readable 206 falls back.
397f9c2b99 makes a stripe Content-Range that does not name the range and the file's size fall back, and restarts the retry count after a short body that delivered bytes. A stripe 206 whose Content-Range parses but names other bytes or another size still fails the read, as you say.
The head is 397f9c2b99; please build on that. The decisions in items 1 to 6 are with the maintainers.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (3)
Major · Keep sequential playback when the plan URL returns the whole file. · parallelRangeSource.ts:474
web/src/player/engine/parallelRangeSource.ts:474 Major · Functional Correctness · Heavy lift
Keep sequential playback when the plan URL returns the whole file.
If an intermediary ignores Range, the plan URL can return a valid 200 with the whole file. Mediabunny’s stock UrlSource switches to sequential mode. The parallel path rejects the same response during the initial probe, and the worker reports an open failure instead of trying the stock source. The HTTP/1.1 route can select this path even without a separate media origin. (rfc-editor.org)
If the initial plan-URL request returns a whole-file 200, reopen with UrlSource. Keep the strict 206 checks for responses that will be assembled as ranges.
Minor · Cancel a rejected response before making its slot available. · parallelRangeSource.ts:374
web/src/player/engine/parallelRangeSource.ts:374 Minor · Stability & Availability · Quick win
Cancel a rejected response before making its slot available.
If a later stripe reports a different file size while the head is still downloading, checkResponse throws before the reader takes ownership of the body. readRange releases the slot, but the rejected body is not canceled. The worker only acts on the failure when that stripe reaches the front of its queue. Until then, another worker can start a request in the freed slot while the rejected response still occupies the transport.
Cancel the body when checkResponse throws, then propagate the original validation error. Do not change the path for a valid response.
Minor · Do not retry from EOF after the response delivers all expected… · parallelRangeSource.ts:390
web/src/player/engine/parallelRangeSource.ts:390 Minor · Stability & Availability · Quick win
Do not retry from EOF after the response delivers all expected bytes.
If a 16 MiB head request gets an EOF-clipped 206 for a 5 MiB file, the header clamps the orchestrator target but not range.end. If the body delivers all 5 MiB and its next reader.read() rejects, this branch requests bytes starting at EOF. A 416 then turns the completed transfer into a worker failure. The stock source stops once it reaches the clamped target. (raw.githubusercontent.com)
Clamp the scheduled end to the validated file size before reading the body. If a terminal body error arrives after all expected bytes, complete the range without retrying. Keep retrying if any expected bytes are still missing.
Keep the requested offsets in the missing-size test.
The first stripe does not request 0-1. This fixture changes both the offsets and the file size field, so a reader that falls back on the wrong offsets alone could pass. Return bytes ${request.start}-${request.last}/* for this case. That makes the missing size the only reason to fall back.
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: 6dbafea8-b8b5-4795-9526-7096bcf89fbf
Commits
Reviewing files that changed from the base of the PR and between f6bbb81 and 397f9c2.
Files selected for processing: 2
web/src/player/engine/parallelRangeSource.test.ts
web/src/player/engine/parallelRangeSource.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Resume after a valid 206 that covers only part of the request.
If a media origin caps a 2 MiB request at 1 MiB, it can return a valid 206 that starts at the requested offset and reports the correct file size. The stripe gate accepts the header, but this equality check rejects the shorter end. The worker does not read the valid bytes or try the plan URL. HTTP permits a server to send only part of the requested range, and the stock source resumes when that happens. (rfc-editor.org)
Accept a shorter interval that starts at the requested offset and matches the file identity. Request the remainder after the declared bytes arrive. Continue to reject a displaced start, an end outside the request, or a changed total.
The reason will be displayed to describe this comment to others. Learn more.
Correct that a 206 capped below the request fails the read: checkResponse treats bounds that differ from the request as a mismatch, where the stock source asks for the rest. Silo's own routes never cap a range. The author has said above that a stripe answer naming other bytes will fall back to the plan's URL in their next push, so I'm leaving this code to that change.
@darthShadow thanks for the detailed reply. Here is where the maintainers lean on the five open items. These are open for discussion: push back where you disagree, and otherwise please implement them on this branch. I'll stop pushing to it so we don't collide.
Stripe only when the plan names a media origin. Drop the HTTP/1.1 own-origin rule and the proxy-node rule from parallelRangeUrlFor. That matches Web direct play: read the file over parallel range connections #4439 as accepted (off by default), and it keeps a plan URL that answers a range request with 200 on the stock reader, which can play it. Turning the reader on by default can come back as its own proposal, with measurements of the page's other requests on HTTP/1.1 and of proxy nodes behind HTTP/2.
Fix the seek delay and the meter in this pull request. The meter feeds Auto quality, so it should not under-read when this ships: one span per response, with overlapping receiving time counted once, as you describe for the follow-up. For seeks, a narrower floor is not enough on its own, since both running workers keep their targets. Please include a test with both workers busy that shows the seek's first request leaving before either old region drains.
Stop writing an activity row for each range request.isStreamChunk records every /stream/{session_id} request as a session start, which is about 19,000 rows for one 40 GB play at 2 MiB. Keep one playback-start row and keep failures visible. The per-range authorization lookups can stay as they are for now; larger ranges in the follow-up will cut how often they run.
Take the lingering hold out of this pull request. With item 1, the server names a media origin only for plans the API serves itself, so the striped reader never reaches a proxy node, and HoldLingering would change capacity accounting for every proxy direct play with nothing using it. Removing it also removes the max_jobs and node-sessions view effects, so Validation tasks: can go back to none if nothing else reaches Distributed transcode nodes — Web admin #1178 or Distributed transcode nodes — Server #1177. If you have a proxy workload that needs it, say so and we can look at lingering only after a GET that served media, with the record expiring at the same deadline.
Add a field for server.web_media_url in web admin. With explicit opt-in, that field is how an administrator turns this on and off. General → Network already holds the public and local addresses. It needs its web.admin.* catalog keys in silo-translations; a separate pull request is fine if it lands in the same release.
Your plan for the header-authenticated case (leave out parallel_range_url, so every published URL carries st) is the right call; go ahead with it.
…media
A client that sends header_authenticated_media_v1 gets a stream URL with no
st, and the media origin's preflight allows only Range. The plan no longer
names a media origin for such a client, so it reads stream.url.
Signed-off-by: Anagh Kumar Baranwal <[email protected]>
… file
A stripe 206 whose Content-Range disagrees with the request or the file's
size now moves the read to the plan's URL, as any other bad stripe answer
does. The plan's URL keeps failing the read on a mismatch.
Signed-off-by: Anagh Kumar Baranwal <[email protected]>
The engine uses the stripe URL the server names exactly as given and adds no
token to it. A reference to the plan's own stream is striped only when the
page loaded over HTTP/1.1, where the browser opens several connections. A
proxy node's URL is striped as issued.
When the stripe URL is the plan's own URL there is one URL, so no range is a
stripe range: every range uses it, up to 4 at once, and a transport failure is
retried there like any read's.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…HTTP/3
HTTP/2 and HTTP/3 put every request to an origin on one connection, so
parallel ranges there add requests and no connections. A proxy node or a
media origin behind such a front is common enough: the development
deployment's nodes answer over HTTP/2.
After a completed range the reader asks the browser which protocol the
striped URL answered over, and hands the source to the stock reader when it
was HTTP/2 or HTTP/3. The API's and the node's stream answers carry
Timing-Allow-Origin so a cross-origin answer can say. A browser that does not
say leaves the reader striping.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The range that tells the source its URL answers over HTTP/2 can be the one
that takes its worker to its target. Handing that worker on made the stock
reader ask for the bytes after the file's end, which a server refuses with
416.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Lingering session release depends on the canceled request context
A canceled request context can cause the Redis write to fail, leaving the session record missing or with an outdated expiry. Use a detached, explicitly bounded context for the write and cancel it afterward.
File internal/nodesessions/tracker.go, line 235:
Lingering session release depends on the canceled request context
The last release uses the caller's context for the Redis write that preserves the lingering session. If the request has already been canceled, the write can fail and leave the session's record missing or with an outdated expiry. Start a detached, explicitly bounded cleanup context when release begins, cancel it afterward, and use it for this write.
**Also found in:**
- `internal/nodesessions/tracker.go:247-247`
- `internal/proxy/server.go:794-794`
Kody rule violation: [Detach mandatory cleanup from request cancellation and bound its lifetime](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/b3c20cf3-6a41-4161-9af6-2bef16b674e9?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a9b35d0. The proxy already passed a context detached from the request, but nothing bounded it: release now detaches and bounds every write it makes with the tracker's cleanup timeout.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification. The fix in a9b35d052f addresses the concern by making release detach its Redis writes from request cancellation and bound them with the tracker’s cleanup timeout. I haven’t independently verified the commit.
The reason will be displayed to describe this comment to others. Learn more.
Equal records can leave a lingering session with a stale expiry
An in-flight refresh can overwrite the linger expiry with a full session TTL even when lingered and record match. Reconcile the remaining linger deadline as well as the record contents after every attempted refresh write.
File internal/nodesessions/tracker.go, line 447:
Equal records can leave a lingering session with a stale expiry
Record equality does not establish that refresh preserved the current lifecycle state. If the last release starts lingering while the refresh pipeline is in flight, the pipeline can overwrite the release's expiry with a full session TTL even when the bytes match. Reconcile the remaining linger deadline as well as the record contents after every attempted refresh write.
**Also found in:**
- `internal/nodesessions/tracker.go:448-448`
Kody rule violation: [Reconcile session refresh writes with current lifecycle state](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/9b614351-d0ce-45ac-8294-5073919d8ae4?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a9b35d0: after a refresh write, a lingering session's record is written again with the time its linger has left, whether or not the bytes match.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The described change addresses the reported stale-expiry scenario by restoring the remaining linger TTL after a refresh write, even when the record bytes match. I haven’t independently verified the commit or its tests.
The reason will be displayed to describe this comment to others. Learn more.
Overlapping failed requests erase a successful range's linger
A failed request or HEAD request that finishes last can cause a successful media delivery to be forgotten and the session to be deleted. Accumulate delivery state across overlapping holds and use it when the last hold releases.
Prompt for LLM
File internal/nodesessions/tracker.go, lines 228-231:
Overlapping failed requests erase a successful range's linger
When a media-delivering range finishes before an overlapping HEAD or failed range, its `true` result is discarded and the last release deletes the session instead of lingering. Accumulate delivery state across overlapping holds and use it when the last hold releases.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and fixed in b179fb9: a delivery is recorded on the session, so the last release lingers whichever request it belongs to. The new case (a range that delivered media ends while a probe is still open) fails on da6f28b76d.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirming. Recording delivery state on the session addresses the overlap described in the suggestion, and the new regression case checks that the session lingers when the successful range finishes before the probe.
I haven’t independently verified the commit or test.
The reason will be displayed to describe this comment to others. Learn more.
A delayed linger write can resurrect a removed session
A delayed Redis SET can recreate a session for 60 seconds after Remove or Cleanup deletes it. Serialize or reconcile the write against removal and subsequent registrations.
Prompt for LLM
File internal/nodesessions/tracker.go, lines 233-235:
A delayed linger write can resurrect a removed session
A lingering release unlocks before its Redis `SET`, so `Remove` or `Cleanup` can delete the session and then the delayed `SET` recreates its record for 60 seconds. Serialize or reconcile the lingering write against authoritative removal and subsequent registrations.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and fixed in a9b35d0: after its write lands, a lingering release checks that the tracker still knows the session and deletes the record again when it does not. The new case (a Remove during the write) fails on 4b0c0693f5. Cleanup runs at shutdown and takes the same path.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The new test exercises the reported Remove-during-write race, and you’ve confirmed it fails on the earlier revision.
One remaining consideration is subsequent registration of the same session ID: the post-write check should not delete or overwrite a newer registration’s Redis record. I haven’t independently verified whether the fix covers that interleaving.
The reason will be displayed to describe this comment to others. Learn more.
A newer registration is not deleted: the post-write check leaves the record alone when the tracker holds the session or has a touch for it. The delayed write itself can still land over a newer registration's record. For a held session the refresh loop writes the current record back within one interval, as it already does after a late DEL. For a session only Touch registered the older record's type would stay until that session ends. Reaching either needs Remove between a lingering release and its write, and nothing outside the tracker calls Remove today; Cleanup runs at shutdown. I'm leaving that as it is.
The reason will be displayed to describe this comment to others. Learn more.
Understood. The remaining race can temporarily overwrite a newer held session’s record, or leave an older record type for a Touch-only session until it ends. Given the stated interleaving and current callers, leaving it as a known limitation is reasonable. I haven’t independently verified those call paths or the refresh behavior.
…ge source
The source crossed the 800-line limit. The inactivity signal and the
protocol lookup use nothing of the source, so they move to rangeRequest.ts.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… another transport holds it
A range that delivered media could end while a probe for the same session
was still open; the probe ending last then dropped the session. Delivery is
now recorded on the session, so the last release lingers whichever request it
belongs to. A plain hold for the session, as a remux after a replan takes,
ends a running linger: when that remux ended, the direct play's record came
back.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
After the reader handed a source to the stock reader, new reads still got the
32 MiB read-ahead target meant for parallel ranges, and nothing retired a
stock worker, so a seek could wait behind tens of MiB on one connection. The
stock reader now keeps Mediabunny's read-ahead, and a worker handed over keeps
only the bytes its reads still wait for.
The protocol check also no longer stops at the first HTTP/1.1 answer: a front
can answer later requests over HTTP/3.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…removed
The last release of a hold wrote to Redis on the caller's context, without a
bound of its own. It now runs detached from the request and within the
tracker's cleanup timeout.
A lingering release writes its record outside the lock, so a Remove or
Cleanup that landed first was undone by it for the session TTL: the record is
deleted again when the tracker no longer knows the session. After a refresh
write, a lingering record goes back to the time its linger has left, not only
when the bytes differ.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Refresh can extend a lingering session beyond its intended deadline
An in-flight refresh can replace the linger expiry with a full TTL, leaving the Redis record visible after the session stops being counted. Reconcile the remaining deadline even when the refreshed record bytes match.
File internal/nodesessions/tracker.go, line 245:
Refresh can extend a lingering session beyond its intended deadline
Reconcile the remaining linger deadline after an in-flight refresh, even when the refreshed record bytes match. A refresh SET can land after this release and replace the linger’s expiry with a new full TTL; the current reconciliation skips it when the records are equal, leaving the Redis record visible after the session stops being counted.
Kody rule violation: [Reconcile session refresh writes with current lifecycle state](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/9b614351-d0ce-45ac-8294-5073919d8ae4?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. I understand that commit a9b35d052f addresses the refresh race by restoring the remaining deadline for every lingering session written by the refresh. I haven’t independently verified the fix.
File internal/nodesessions/tracker.go, line 254:
Restoring a linger deadline depends on the request context
Use a detached, explicitly bounded cleanup context for the Redis SET that restores the earlier linger’s remaining TTL. If the request context is canceled, this write can fail and leave the hold’s full TTL in place instead of preserving the original deadline.
Kody rule violation: [Detach mandatory cleanup from request cancellation and bound its lifetime](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/b3c20cf3-6a41-4161-9af6-2bef16b674e9?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The reported fix in a9b35d052f addresses the concern by using a detached, bounded context to restore the linger’s remaining TTL. I haven’t independently verified the commit.
The reason will be displayed to describe this comment to others. Learn more.
Overlapping remux and direct-play holds can linger a completed remux
Revises an earlier Kody suggestion on internal/nodesessions/tracker.go:228 (2026-11-19 20:20 UTC).
The node can be counted as serving a completed remux for 60 seconds after the final direct-play release. Reset or separate the delivery state in tr.lingering when a plain hold takes over, including while the direct-play hold is active.
Prompt for LLM
File internal/nodesessions/tracker.go, lines 212-216:
**Revises an earlier Kody suggestion** on `internal/nodesessions/tracker.go:228` (2026-11-19 20:20 UTC).
Overlapping remux and direct-play holds can linger a completed remux
When a remux hold overlaps a delivered direct-play request and ends first, the final direct-play release lingers the shared remux record for 60 seconds, so the node remains counted as serving a remux that has already ended. Reset or separate the lingering delivery state when a plain hold takes over, including when the direct-play hold is still active.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and fixed in bfc766b: a session that a plain hold joined ends at its last release, so a direct-play range that outlives the remux no longer makes it linger. The new case fails on a9b35d052f.
…hat outlived a remux
A replan to remux on the same node can start while a direct-play range is
still open. When the remux ended first, that range's release was the last and
made the finished remux linger for the session TTL. A session a plain hold
joined ends at its last release.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Linger cleanup can delete a newly registered session record
Revises an earlier Kody suggestion on internal/nodesessions/tracker.go:233 (2026-11-19 20:20 UTC).
A new hold or touch can write a Redis record after the unlocked held and touched check, then Del removes that active record. Serialize the check and cleanup with registrations, or reconcile the record after deletion.
Prompt for LLM
File internal/nodesessions/tracker.go, lines 295-299:
**Revises an earlier Kody suggestion** on `internal/nodesessions/tracker.go:233` (2026-11-19 20:20 UTC).
Linger cleanup can delete a newly registered session record
After the unlocked `held` and `touched` check observes an empty session, a new hold or touch can write its Redis record before this DEL, which then removes the active session's record. Serialize the state check and cleanup with subsequent registrations, or reconcile the record after the delete.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and fixed in 83deb58: the check and the delete now run under the tracker's lock, so a Hold or Touch that registers the session again sends its SET after them. The delete only happens when the tracker no longer knows the session, which needs a Remove or Cleanup during the write.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirming. The lock-based change in 83deb583f2 addresses the reported race: a new Hold or Touch cannot register between the state check and the cleanup delete.
If the refresh pipeline partially succeeds before cancellation, pipe.Set cannot restore the lingering record's remaining TTL, leaving a full-TTL record visible after the session stops being counted. Run reconciliation with a detached, bounded context.
File internal/nodesessions/tracker.go, line 514:
Canceled refresh context prevents linger reconciliation
Run refresh reconciliation with a detached, bounded context. If the refresh pipeline partially succeeds and its context is canceled, this SET inherits the canceled context and cannot restore the lingering record’s remaining TTL, so a full-TTL refresh write may remain visible after the session stops being counted.
Kody rule violation: [Reconcile session refresh writes with current lifecycle state](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/9b614351-d0ce-45ac-8294-5073919d8ae4?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Running reconciliation with a detached context bounded by the cleanup timeout addresses the cancellation concern in the original suggestion. I haven’t independently verified commit 83deb583f2 or its tests.
The reason will be displayed to describe this comment to others. Learn more.
A previous remux disables lingering for a subsequent direct play
Revises an earlier Kody suggestion on internal/nodesessions/tracker.go:212 (2026-11-19 20:28 UTC).
A direct-play request that starts during a remux hold inherits plain = true, so its final release deletes the session between range requests. Track the most recent transport instead of permanently marking entry.plain when a plain hold joins.
Prompt for LLM
File internal/nodesessions/tracker.go, lines 216-217:
**Revises an earlier Kody suggestion** on `internal/nodesessions/tracker.go:212` (2026-11-19 20:28 UTC).
A previous remux disables lingering for a subsequent direct play
A direct-play request that starts while an earlier remux hold is still active inherits `plain = true`, so its final release deletes the session instead of retaining it between range requests. Track which transport most recently took over, rather than permanently marking the shared entry when any plain hold joins.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and fixed in 83deb58: the latest hold decides which transport the session is on. A lingering hold taken after a plain one makes it a direct play again, and a plain hold taken after a lingering one ends its linger. The new case (a direct play's first range starts while the remux request is still open) fails on 8b67372109; the earlier case in the other direction still passes.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirming. The reported fix in 83deb583f2 addresses both transport orderings, and the new regression test distinguishes it from 8b67372109. I haven’t independently verified the commit or test results.
…ialize the linger cleanup
A direct-play range that started while a remux request was still open
inherited the remux's mark and ended the session at its release, so the play
left the count until its next range. The latest hold now decides: a lingering
hold after a plain one makes the session a direct play again, and a plain hold
after a lingering one ends its linger.
The cleanup after a lingering write checked the tracker and deleted outside
the lock, so a registration between the two lost its record. Both run under
the lock. The repair after a refresh no longer rides on refresh's context.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enhancementNew feature or requestimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishsize/XXXL3000+ added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: #4439
Validation tasks: changes #1177 C2, C3; changes #1178 C2
Other clients: Apple N/A (does not send
parallel_range_origin_v1, so its plans do not change; a direct play through a proxy node stays counted on the node for up to 60 s after its last request, on every client); Android N/A (same); Roku N/A (same)In the web app, a direct-play file is read over one HTTP connection. On a long or lossy link, one connection moves only a fraction of what the link can carry, so playback stalls while the link has spare room. This affects viewers far from the server, and the administrators who serve them. This change reads the file as several byte ranges at once, over separate connections, in the browser's decode engine. The engine plays files the browser's media element cannot take as they are. The proposal is in #4435.
Approach
The reader. A Mediabunny source keeps Mediabunny's read orchestrator, cache and prefetch profile and changes only how bytes arrive. Each read worker sends closed ranges of 2 MiB, with at most 4 in flight per source. The first 16 MiB of each read (the warm head) comes from the plan's own URL while the extra connections warm up. A range that finds the stripe URL busy goes to the plan's URL. The first answer from the stripe URL that is not a readable 206, or the first transport failure there, sends the rest of that range and every later range to the plan's URL, with no retry spent on the stripe URL. A stripe body that runs past its range moves the read to the plan's URL the same way.
The engine stripes only when the plan names a stripe URL in
stream.parallel_range_url, and it uses that URL exactly as given. The server names one of three:stream.urlalready carries. With the default routing (playback.routing.direct_play_egress=prefer_proxy) this is the usual case on a deployment with proxy nodes, and it needs no setting.server.web_media_urlis set: the same stream on that media origin, an https address that serves the same API over HTTP/1.1 only. It is for a deployment whose main address speaks HTTP/2.HTTP/2 and HTTP/3 put every request to an origin on one connection, so parallel ranges there add requests and no connections. After a completed range the reader asks the browser which protocol the striped URL answered over, and returns to Mediabunny's stock
UrlSourcewhen it was HTTP/2 or HTTP/3. A browser that does not say leaves it striping. When the stripe URL is the plan's own URL (a node, or the page's origin) there is one URL: every range uses it, up to 4 at once, and a transport failure is retried there like any read's. Without a stripe URL the engine reads the plan's URL through the stockUrlSource, over one connection, as before. A plan URL that ignoresRangeand answers the open with the whole file also plays through the stock reader, in order. The reader wraps the prefetch profile it finds and takes the larger of its own read-ahead end and the inner profile's end, so a read-ahead change on the plainUrlSourcepath composes with it in either order. Mediabunny is pinned to1.62.1instead of^1.62.1, because the source readsUrlSourceand orchestrator internals.The server.
New admin setting
server.web_media_url: an https origin that serves the same API over HTTP/1.1 only. Empty names no media origin, and a change applies without a restart. It is named only for a client that arrived by the default access path; one that came through a network access provider gets the plan's own stream.New client feature
parallel_range_origin_v1: the client's promise to usestream.parallel_range_urlexactly as given, adding no account token to it, when the plan has one, and to readstream.urlotherwise. The server sets the field on anoriginal_httpplan as listed above. The two API forms carryst, which authorizes only an attempt a login session started, so only such an attempt gets them.stream.urlstays valid either way.GET,HEADandOPTIONSon/api/v2/stream/{session_id}answer withAccess-Control-Allow-Origin: *, allow theRangeheader and exposeContent-Range, with no credentials.GETandHEADcarry these headers on every answer, refusals included, so the page can read a refusal. The preflight is answered before authentication. It carriesAccess-Control-Max-Age: 600and writes no activity-log row. Authorization stays in the URL's token andst. No other route gains CORS. The API's and a node's stream answers carryTiming-Allow-Origin: *, so the reader can learn the connection's protocol.On the native stream routes, a request from byte 0 or with no
Rangeheader writes an activity-log row, as before. A range that continues a play (it starts past byte 0) writes a row only when it fails; one that succeeds, or that the client abandons (499), writes none. AGETanswered200keeps its row whatever its range: a progressive remux started again from its origin is a new stream. The Jellyfin stream routes still write one row per request; matching them is a possible follow-up.On a proxy node, a direct-play session stays counted between range requests: the last request to end keeps it for the 60 s session TTL when it delivered media. A
HEAD, a refusal or an unsatisfiable range adds no such hold and ends none that is running, and the session's record expires with its count. A plain hold for the session, as a remux after a replan takes, ends a running linger; while holds of both kinds overlap, the latest one decides. Without this a striped play dropped out of the node's capacity count and the admin's node-session list in every gap between ranges.Credentials. The stripe URL always authorizes itself:
ston the API forms, the token in the path of a node's URL. The player uses it as given and adds no account token, header or cookie; an earlier revision had it append the access token to a URL withoutst, which would have sent a login token to a node. The server never names a node's header-authorized route, and an attempt that negotiatedheader_authenticated_media_v1gets no stripe URL. An attempt with no login session, such as one an API key started, gets none on the API routes. It readsstream.url, which keepsstand the token and can still rebuild an evicted session. Every other playback URL keeps the token it carries today.The contract change is one optional field (a URL reference) and one feature name.
docs/playback-api.md,docs/architecture/playback-protocol-v3.mdanddocs/architecture/api-contract.mddescribe them, and the OpenAPI document, the web types and the playback fixtures are regenerated.The meter. The engine's throughput meter now counts the time each response was receiving, from its first body chunk to its latest, and counts overlapping time once. Bytes from parallel ranges are divided by that union, not by the sum of each range's time. The striped source counts all its ranges into one request and keeps that union as merged stretches, so a long play does not grow the list by one entry per range. A stock read stays a request of its own, so the meter's 1,000 ms rule applies to it as before.
Seeks. A seek that finds both read workers busy no longer waits for their read-ahead. At the seek, each queued read is cut to the bytes Mediabunny still waits for. When the seek's first read then finds both workers running, each older worker is cut to the bytes its waiting reads need, and its ranges that hold none of those bytes are cancelled. The older worker that owes the fewest bytes stops at once, its unmet bytes go back on the queue, and the seek's read takes its place and the first free connection. In a Node run of four seek patterns on two Matroska files over a 2 MiB/s throttled link, the wait from the last seek to its first request fell from 5.27-7.84 s to at most 0.01 s, and the first video packet came 1.04-2.72 s after the seek instead of 7.31-10.97 s. A read the replaced playback makes after the seek still counts as new. A seek whose first read asks for the same hole as a read queued before it (near the end of the file) retires a worker like any other, and the new worker takes the queued reads it covers.
HTTP/2 multiplexing was not an option, since it puts every request on the one connection this change needs to get away from. Adaptive range sizes and four fixes for faults found in a real-browser test follow in the next pull request.
The web changes add no user-visible text, and the setting has no settings-page label, so there are no
silo-translationskeys.Validation
e775bf9, including the database pins and the Prometheus rules test. The last commit changes only comments; its focused tests, lint, size and local-path checks pass.stand no token, and each 206 allowed the origin and exposedContent-Range. Playback reached 30 s with no alert. A seek to 70 s and then back to 50 s played on from 50 s. The play left one activity-log row on the stream route, a206.eff92e0d2a(fd99395415,0647945ded): each new or changed test fails ond8f12d469c. On a dev deployment built from that head, Chrome on the engine route sent 148 ranges to an HTTP/1.1 media origin (up to 3 at once, each withstand no token) and 24 to the plan's URL, three seeks sent their first range within about 100 ms, a seek into the last 20 s played on, the credits Skip control worked, the play left one activity-log row, and an explicit preflight answered204withAccess-Control-Max-Age: 600and left no row. The maintainer's summary comment links that run's evidence page.83deb583f2(afd2ef25df,9dfa390083,a53a9bea38,faea666732,9c10b806a6,4b0c0693f5,b179fb9d16,a9b35d052f,bfc766b3a6,83deb583f2): restores striping on a proxy node's URL and on the page's own origin, which round 1 had asked to remove. Each new or changed test fails on the earlier head. On a dev deployment with proxy nodes, in Chrome on the engine route (the node runs on a build of83deb583f2, the API-served runs on9c10b806a6): through a node over HTTP/2 the reader sent a few ranges and returned to the stock reader (19 requests); through a node over HTTP/1.1 it striped for the whole play (164 closed ranges, up to 4 in flight, no account token), and the node listed the session during play and 30 s after the browser closed, and not at 75 s; API-served over HTTP/1.1 it striped on the page's origin (164 ranges, one activity-log row); API-served over HTTP/2 it used the stock reader (19 requests); with a media origin it striped there (132 ranges withstand no token). Three seeks worked in every run. The maintainer's summary comment links that run's evidence page.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4497/
Surface and build: web player, browser engine route. The page names the build of each result. It holds the first round's gate, Chromium request lists and a lab measurement of startup, stalls and throughput against the single-connection reader on a 350 ms, 1% loss link; its
h1cell measured the same-origin rule this round removes. Its last section holds this round's gate, the browser request list with the seek check, and the Node seek table.Risks
stin the URL.max_jobs, and shows in the admin's node-session list, for up to 60 s after its last request. That is the reason for theValidation tasks:line: Distributed transcode nodes — Server #1177 C2 and C3 and Distributed transcode nodes — Web admin #1178 C2 should be walked again. The planner's own admission has older gaps this does not close (it drops a reservation when a newer health report arrives, and reservations are per API server).server.web_media_urlis classed as a server-specific setting, so a restore onto another server does not carry it.Checklist
AI Disclosure
claude-opus-5-5,claude-sonnet-5-5(Claude Code);gpt-6.1-sol(Codex CLI)claude-opus-5-5in Claude Code,gpt-6.1-solin Codex CLI) read the change twice, on the rebased branch and on the finished stack, and aclaude-sonnet-5-5seat merged each pair's findings. They ran mutation checks on the tests they relied on. The first round found two High defects in the lingering session hold, and both were fixed and re-run. The second found a Medium defect, a failing media origin failed the read instead of falling back to the plan's URL, and a few documentation and comment errors. All were fixed and checked by a separateclaude-sonnet-5-5seat. For the maintainers' second round, agpt-6.1-solseat reviewed the plan before any code was written, the same two-model pair reviewed the result (one Low finding, fixed), and a separateclaude-sonnet-5-5seat checked each change against the code. The seek fix went through the same steps: the pair compared designs and reviewed the plan, then reviewed the result (three Low comment findings, fixed), and a separate seat checked the change against the plan. The maintainer's review fixes and rework (fd99395415,0647945ded,3c4b1edc2b, and the commits fromafd2ef25dfto83deb583f2) were written in Claude Code withclaude-fable-5-2.gpt-6.2-solandclaude-opus-5-5reviewed the fix plan first;gpt-6.2-astra,gemini-4-neonand an independentclaude-fable-5-2reviewed the design of the proxy-node rework before it was written, and each changed it.Note
Add parallel range connections for direct play of original files
parallel_range_origin_v1playback feature and optionalstream.parallel_range_url. The server publishes it for eligible original-HTTP deliveries (playback_v3.go), and the web player reads the file through a newParallelRangeSourcethat stripes requests over the plan URL and optional stripe URL (parallelRangeSource.ts).Timing-Allow-Originhandling for the original-file stream route, including unauthenticated OPTIONS preflights (playback_delivery.go).nodesessions.Tracker.HoldLingering, which keeps a direct-play session alive across the gaps between striped range requests when at least one request delivered media (tracker.go).createMeteredFetchreports merged receiving-time spans, and throughput now uses unioned receiving time instead of each request's full first-to-last interval (mediaFetch.ts, media-data-meter.ts).server.web_media_urladmin setting (bare HTTPS origin) and a new stream-path filter that omits range-continuation and preflight requests from activity logging.mediabunnyis now pinned to exactly1.62.1becauseParallelRangeSourcedepends on Mediabunny internals (mediabunnyInternals.ts); upgrading requires re-checking that internal surface.MediaDataMeter.throughputKbpschanges how throughput is computed for striped reads.Macroscope summarized 83deb58.