Skip to content

fix(playback): don't learn a bandwidth limit from a stall the server's transcode caused - #4640

Merged
Quick104 merged 10 commits into
Silo-Server:mainfrom
Rhainland:fix/playback-remote-transcode-bandwidth-limit
Nov 22, 2026
Merged

Quick104 merged 10 commits into
Silo-Server:mainfrom
Rhainland:fix/playback-remote-transcode-bandwidth-limit

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

Other clients: Apple Silo-Server/silo-apple#1237 and Android Silo-Server/silo-android#1011 (clients send observed_rebuffer only with slow-transfer evidence); Silo-Server/AetherEngine#30 (the relay times segment bodies from first byte to last, which Apple uses as that evidence); Roku N/A (the server check needs no client change); Web: follow-up #4643 (the web player still sends observed_rebuffer on every Auto lowering, against the slow-link evidence rule this PR documents; the server check here still keeps an encoder-paced stall from being learned)

Same report (an MKV with many large embedded fonts and ASS subtitles): #4639, #4641, #4642, Silo-Server/silo-android#1010

When a transcode runs slower than real time, a client on Auto stalls and the server learns that stall as the device's bandwidth limit for 24 hours. Later files that should direct play on that device then start as low-quality transcodes. A heavy ASS burn-in is a common cause: an MKV with many large embedded fonts produced each 2-second segment in about 8 seconds. The link was fine, and the server was the bottleneck.

With this change the server still plans the replan under the client's lowered estimate, so the smaller output can ease the encoder. It stores no limit when the playing transcode had no lead over the client. That holds on the API replica and on a remote transcode node.

Approach

Before a quality_change replan records an observed_rebuffer estimate, the server checks whether the client was waiting on the encoder. That means one of two things: a restart is replacing FFmpeg, or the client has finished downloading every produced segment but at most the newest while FFmpeg runs or after it failed. An encoder that keeps up runs ahead of the client up to the throttle window. A slow link leaves it far ahead, so a slow link still records. Output an earlier FFmpeg generation left behind does not count as lead, matching the throttler.

  • Local transcode: the replica judges it from its live session (TranscodeSession.OutputBoundsClient).
  • Remote node: the replica asks the node with a signed GET /transcode/{session_id}/output-bound. The node counts segment downloads from the relay acknowledgements it already receives, so the answer is the same whichever replica or proxy relays the stream. The read happens only for a replan that would record, and it has a 2-second timeout.
  • Unknown answer: the stall counts as the server's and nothing is recorded when a node on the session's route is unreachable (the transcode node or the egress proxy the replan already probed, whatever the delivery), the node no longer runs the transport, fails the read or times out, an HLS session has no transcode on this replica and none on a node (being rebuilt, or run by another replica), or the playback session is gone by the time the replan checks. Each of those is a server-side fault. Skipping the record loses only memory, because a real slow link stalls again and is learned then. A wrong limit lowers every file the device plays for a day.
  • Progressive remux: it has no segment lead, so it is never judged bound, wherever it runs, unless its node is unreachable.
  • Nothing to record: a replan with no device ID or connection key can't store a limit, so it doesn't ask.

The buffering-quality design gains a "Slow-link evidence" section with the matching client rule. A client's link speed is never measured by how long the server takes to produce what the client waits for. Throughput is timed only while bytes flow, and a lowering without that evidence goes out with no estimate source. The conformance section now says the shared vectors assume slow-link evidence, which is how the Android and Apple harnesses replay them. The worker contract is in docs/architecture/worker-http-protocol.md, the recording rule in docs/architecture/playback-protocol-v3.md, and the route inventory and OpenAPI artifacts are regenerated.

#4475 changes the same recording step for a different cause: a lowering that the connection's measured speed contradicts (#4468, a sleeping disk on direct play). The two checks are independent. Whichever merges second needs a small rebase in applyLearnedLimit and the learned-limit docs.

Validation

  • Unit tests cover the encoder-lead rule: restarts, an in-flight first segment, stale earlier-generation output and a finished encoder. They also cover the node route: running, finished, remux, unknown and unsigned. On the core side they cover the node's answers, failures, an unreachable node and a remote remux.
  • The learned-limit DB contract test checks that an encoder-bound stall plans under the estimate and leaves the stored limit and its timestamp unchanged. It passes against a migrated Postgres 18 (pgvector) database.
  • go test on internal/playback/..., internal/transcodenode, internal/api/handlers (with the DB), internal/apiv2 and internal/telemetry: pass. Under umask 002, three upload tests in internal/api/handlers fail on main as well (group-writable temp dirs). They pass under umask 022.
  • go build ./..., gofmt, go mod tidy -diff, go vet on the touched packages, make lint-changed (0 issues) and make lint-router-recovery: clean.
  • verify-route-inventory, verify-apiv2-openapi, verify-apiv2-contract (0 changes), verify-apiv2-fixtures, verify-apiv2-web-types, verify-playback-fixtures, TestCommittedArtifactMatchesRouter, verify-local-paths, verify-case-collisions, verify-size-ratchet, verify-bidi and verify-migrations: pass.
  • Not run locally: the whole make test-go and the web gate. This change touches no web code; CI runs both.
  • Maintainer review: live before/after check on a sandbox (see Evidence). New TestTranscodeOutputBoundAsksTheRemoteNode cases for unreachable route nodes, an HLS session with no visible transcode and a vanished session fail on the head before each fix. internal/api/handlers passes, including the learned-limit DB contract tests against a migrated Postgres 18 database.

Evidence

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

Live, on a Silo dev deployment: a client that kept up with a transcode slower than real time (each 2-second segment took 4.5 to 6 seconds) sent an Auto observed_rebuffer replan. On main it stored a 1400 kbps limit for 24 hours. On this branch it stored nothing, and the server logged that it skipped the record. A slow-link control (the client stops fetching while the encoder runs ahead) still stored the limit on this branch.

Nothing visible changes on a screen. The effect is that a later title is not lowered, and these tests check it at the points where that is decided. The results are from go test -v on this branch, trimmed:

--- PASS: TestTranscodeOutputBoundsClient
    --- PASS: .../client_at_produced_head
    --- PASS: .../head_segment_not_yet_fetched
    --- PASS: .../encoder_ahead_of_the_client
    --- PASS: .../encoder_finished
    --- PASS: .../restart_with_both_new_segments_still_undelivered
    --- PASS: .../restart_whose_first_segment_is_still_being_encoded
    --- PASS: .../restart_in_flight
    --- PASS: .../restart_still_stopping_the_old_encoder
    --- PASS: .../earlier_generation's_output_far_ahead_of_a_restart
ok   internal/playback
--- PASS: TestOutputBoundRouteAnswersForTheNodesSessions (waiting, finished, remux, unknown, unsigned 401)
ok   internal/transcodenode
--- PASS: TestSeekReplayKeepsLearnedLimitDB   (encoder-bound stall: plans 5163, stored 31000 and its timestamp kept)
--- PASS: TestTranscodeOutputBoundAsksTheRemoteNode
    --- PASS: .../node_reports_the_client_waiting_on_the_encoder
    --- PASS: .../node_reports_the_encoder_ahead
    --- PASS: .../node_does_not_run_the_transport
    --- PASS: .../node_fails_the_read
    --- PASS: .../node_answers_garbage
    --- PASS: .../replan_found_the_node_unreachable
    --- PASS: .../no_transcode_on_this_replica_or_a_node
    --- PASS: .../remote_progressive_remux
ok   internal/api/handlers

Risks

  • Transcode on another replica: a local transcode running on a different API replica from the one that answers the replan is invisible to the check. The stall counts as unknown and records nothing, so learned limits from such transcodes are learned only when the replan reaches the replica that runs them.
  • Older nodes: a transcode node built before this change answers the new read with 404. The core reads that as unknown and learns no limit from stalls on that node's transcodes until the node is upgraded. Stalls still lower quality as before. NodeControlVersion is unchanged.
  • Extra node read: one extra signed node read per recording quality_change replan, bounded at 2 seconds. It has its own output_bound telemetry operation.

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.

Council review

Rounds: 2, last reviewed abfadd1

Member Round 1 Round 2
Sol (gpt-6.2-sol, xhigh) 6/10 8/10
Opus (claude-opus-5-5, high) 8/10 8/10
Gemini (gemini-4-neon, xhigh) 7/10 9/10

Visual review: none; nothing on a screen changes.

Fixed: unreachable route nodes, HLS sessions with no visible transcode and vanished sessions now count as unknown; replans that can't record skip the node read; the protocol doc's Auto-lowering paragraph and the network-change evidence rule. Answered: replan-time sampling, lost relay acknowledgements and the restart read race all fall back to recording, as main does.

AI Disclosure

  • Harness: Claude Code

  • Tool(s): Claude Code; Codex CLI (review); GitHub CLI

  • Model(s): claude-opus-5-5 (implementation and review); gpt-6.2-sol and gpt-6.2-astra via Codex CLI (review); Claude Fable 5.2 (review)

  • Involvement: Fully AI-generated, human verified

  • Maintainer review fixes (abfadd1, 643ab5b): Claude Code, claude-opus-5-5; council review in Council review above.

  • Adversarial review: four independent reviewers (gpt-6.2-sol, gpt-6.2-astra, claude-opus-5-5, Claude Fable 5.2) read the branch diff on correctness, repo standards and intent. A second and third round reviewed the follow-up fixes. Fixed:

    • The lead check counted a segment as fetched when it was requested rather than downloaded.
    • It read stale earlier-generation output as lead.
    • It missed a restart in flight, and it read its two inputs in separate snapshots.
    • A finished remote progressive remux could read as a server stall.
    • The node read was labeled status in telemetry.
    • The skip log claimed a cause when the answer was unknown.
    • The conformance vectors were not reconciled with the slow-link rule.
    • Older-node behavior was undocumented.

    Dismissed with reasons:

    • Sub-millisecond read-order races between the manifest read and a segment completing.
    • Out-of-order completion of prefetched segments. It errs toward not recording.
    • Filesystem clock skew between the cache volume and the worker.
    • An end-to-end replan test of the one-line wiring.

Note

Fix learned bandwidth limits to ignore server-caused transcode stalls

  • Stops recording an observed_rebuffer learned limit when the transcode output itself is the bottleneck. PlaybackHandler.applyLearnedLimit now takes an outputBound callback and skips recording when it reports the transcode has kept up or its status is unknown (playback_connection.go)
  • Adds TranscodeSession.OutputBoundsClient to detect when the client has caught up with the encoder's output, covering restarts, stale output, and failed encoders (transcode.go)
  • Adds an authenticated GET output-bound route on transcode nodes (server.go), a signed remote client via TranscodeManager.RemoteOutputBound (transcode_manager.go), and telemetry/protocol registry entries for the new operation
  • Updates Auto-lowering rules in the buffering-quality design and playback protocol docs: a lowering without slow-link evidence sends no source and records nothing
  • Behavioral Change: older transcode nodes without the output-bound route prevent learning from their transcodes (treated as server-paced); unreachable or unknown transcode status also skips recording the limit

Macroscope summarized 9372dbe.

A client on Auto that keeps rebuffering sends an observed_rebuffer
quality_change replan, and the server stores its estimate as the device's
learned limit for 24 hours. When the stall came from the server's own
transcode running slower than real time (a heavy ASS burn-in producing each
2 s segment in about 8 s), the stored limit pushed later, unrelated files
that should direct play into a 720p transcode.

The replan now checks the playing transcode before recording: when the
client has fetched every produced segment but at most the newest, the
encoder had no lead and paced playback, so the replan still plans under
the estimate but the device learns no limit. A transcode that keeps up runs
ahead of the client up to the throttle window, so a slow link still records.
Transcodes on remote nodes are not visible to the API server and keep
today's behavior.
The replan skipped learning a bandwidth limit from an observed_rebuffer
stall only when the playing transcode ran on the replica answering it. A
transcode on a remote node was invisible there, so a burn-in slower than
real time on a node still stored a day-long limit that pushed later
files off direct play.

The node now answers GET /transcode/{session_id}/output-bound from its
live session: true while FFmpeg runs and the client has fetched every
produced segment but at most the newest. Segment fetches reach the node
as relay acknowledgements, so the answer holds whichever API replica or
proxy relays the stream. The replan asks it only when it would record.

An unknown answer counts as the server's stall and records nothing: the
replan already found the node unreachable, the node no longer runs the
transport, or the read failed or exceeded two seconds. Those are
server-side faults, like a node dying mid-stream. Skipping the record
loses only memory, since the replan still plans under the client's
estimate, while a wrong limit lowers every file the device plays for a
day.
The output-bound check compared the produced head with the last requested
segment, which a restart seeds with its start segment and a planned copy
advances when a request starts. After a seek on a slow link, the client
still downloading the restart's first segment of two produced ones read as
waiting on the encoder, so a real slow link went unlearned. The check now
uses the last completed download, and treats manifest output left by an
earlier FFmpeg generation as no lead, as the throttler does.

A remote progressive remux is no longer asked about: it has no segment
lead, as on the API replica, and its request may have ended, which the node
answers with 404 and the core would have read as the server's stall.

The node read gets its own telemetry operation instead of sharing
"status", the log line says the stall was attributed to the server rather
than claiming the encoder paced it, and the docs say an older node without
the route teaches no limit until it is upgraded. The buffering-quality
conformance section states that the shared vectors assume slow-link
evidence, which is how the client harnesses replay them.
…art as the server's

OutputBoundsClient now reads the completed-download position inside the
same SegmentProgress snapshot as the produced head, so a restart between
two reads cannot pair one generation's head with the next one's counter.
A restart in flight leaves the client waiting on the server for its whole
length, including the part that validates the source and stops the old
FFmpeg while it still runs, so it counts as bound. The node's output-bound
contract says so. The log line no longer claims a cause when the answer
was unknown, and the conformance note on slow-link evidence joins the
existing vector-harness bullet and is scoped to Auto lowerings.
@silo-triage silo-triage Bot added the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Nov 20, 2026
@silo-kody

silo-kody Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P1 Core-path bug; painful workaround — next after P0 labels Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds transcode output-bound status to node and playback flows. Playback replans check that status before recording an observed-rebuffer limit. It also updates API contracts, protocol documentation, route metadata, telemetry, tests, and buffering-quality guidance.

Changes: Transcode-Paced Stall Detection

Layer / File(s) Summary
Track local transcode output progress
internal/playback/transcode.go, internal/playback/copy_keyframe_plan.go, internal/playback/transcode_manifest_test.go
SegmentProgress now includes the client’s last completed segment and whether the encoder stopped with an error. OutputBoundsClient uses progress and restart state to report whether the client is waiting on server output. Tests cover encoder progress and restart states.
Expose output-bound status through transcode nodes
contracts/api/v2/openapi.json, contracts/api/v2/route-inventory.json, internal/transcodenode/*, internal/playback/transcode_manager.go, internal/telemetry/node_http.go, internal/apiv2/worker_streaming_test.go, docs/architecture/worker-http-protocol.md
The authenticated GET /transcode/{session_id}/output-bound endpoint returns an output_bound boolean or 404 when the node does not run the transport. The playback manager sends a signed request with a two-second timeout. Contracts, route metadata, telemetry, fixtures, tests, and documentation describe the route.
Gate learned limits on transcode pacing
internal/api/handlers/playback_connection.go, internal/api/handlers/playback_v3.go, internal/api/handlers/playback_connection_test.go, docs/architecture/playback-protocol-v3.md, docs/design/2026-10-17-buffering-quality.md
For eligible observed-rebuffer replans, playback checks whether transcode output paced the client before recording a learned limit. Tests cover local and remote checks. Buffering guidance defines slow-link evidence and explains how replans send estimates without that evidence.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant PlaybackV3
  participant applyLearnedLimit
  participant transcodeOutputBoundV3
  participant TranscodeManager
  participant TranscodeNode
  participant Connections
  PlaybackV3->>applyLearnedLimit: Pass output-bound callback
  applyLearnedLimit->>transcodeOutputBoundV3: Check eligible observed-rebuffer replan
  transcodeOutputBoundV3->>TranscodeManager: Request remote output-bound status
  TranscodeManager->>TranscodeNode: Send signed GET request
  TranscodeNode-->>TranscodeManager: Return output_bound
  TranscodeManager-->>transcodeOutputBoundV3: Return status
  transcodeOutputBoundV3-->>applyLearnedLimit: Return status
  alt output_bound is false
    applyLearnedLimit->>Connections: Record observed estimate
  else output_bound is true
    applyLearnedLimit-->>applyLearnedLimit: Skip recording observed estimate
  end
Loading

Possibly related issues

Suggested reviewers: quick104, blurbery

Merge Risk: Low · up to 9372d

Playback replans now skip recording a bandwidth limit when the server's transcode caused the stall, and unknown status errs toward not recording. One narrow timing race could still let an encoder-paced stall be recorded as a 24-hour device limit. It is rare, bounded, and matches the previous behavior, so the change is mergeable with owner awareness.

Security architecture risk: Minimal · up to 9372d

The new status check uses existing authentication and limits its effect to whether a bandwidth observation is saved. Unavailable or older nodes suppress learning without rejecting the replan. The inspected changes establish no material weakening of access control, state ownership, or recovery behavior.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The changed persistence decision concerns a learned limit keyed by authenticated user, device and connection. The node-side status lookup concerns an existing local transport selected by a signed caller; it introduces no tenant-wide or administrative write.

Trust Boundaries and Controls

  • observed — Client-triggered replans require authentication and matching attempt user/profile ownership before execution. The subsequent status request uses the same node keyring and signing function as existing remote-stop requests, and the new route remains inside the existing signature-protected group.

Resilience and Maintainability Implications

  • inferred — Unknown status conservatively withholds a new optimization record rather than granting access or changing process ownership. The bounded read adds latency to eligible replans but neither reconstructs missing transports nor introduces another cleanup obligation.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the primary change: the server no longer records a learned bandwidth limit from a stall that the server's transcode caused. The changeset matches this: applyLearnedLimit gains an outpu…
Description check Passed The description states the problem (a slow transcode causes client stalls that the server learns as a 24-hour bandwidth limit), the approach (encoder-lead check, remote output-bound route, unknown-ans…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the primary change: the server no longer records a learned bandwidth limit from a stall that the server's transcode caused. The changeset matches this: applyLearnedLimit gains an outputBound callback, OutputBoundsClient is added, and an output-bound route is added to the transcode node.

Full details: Description check

Explanation

The description states the problem (a slow transcode causes client stalls that the server learns as a 24-hour bandwidth limit), the approach (encoder-lead check, remote output-bound route, unknown-answer handling), and the validation. It matches the changes in the playback handler, transcode session, transcode node route, and design docs.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent 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: 3816b107-3f17-4703-b49e-0b6cbe1ef9a7
Commits

Reviewing files that changed from the base of the PR and between 643ab5b and 9372dbe.

Files selected for processing: 3

  • contracts/api/v2/openapi.json
  • internal/playback/transcode.go
  • internal/transcodenode/server.go

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

Comment thread internal/playback/transcode.go Resolved
Comment thread internal/playback/transcode.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Minor comments: 1

internal/playback/transcode.go: 1

3160-3160: Minor · Functional Correctness · Poor tradeoff

Read completion and produced head as one observation.

SegmentProgress copies LastCompletedSegment under s.mu, releases the lock, and then reads the manifest to set ProducedHead. A segment download that completes between these reads can leave the completion value older than the produced head. OutputBoundsClient then compares a newer produced head against an older completion value.

For example, the snapshot records LastCompletedSegment as 4. The client then completes segment 5, FFmpeg publishes segment 6, and the manifest read returns ProducedHead as 6. The encoder leads by one segment, but the check computes 6 - 4 = 2 and returns false. A server-paced stall can then record a bandwidth limit, which this change is meant to prevent. The race is narrow, but the result is persisted.

plannedSegmentProgress has the same split. It reads LastCompletedSegment under the lock and calls s.copyGroups.progress() after unlocking.

Required behavior: OutputBoundsClient must decide from completion and produced head values that come from one consistent observation. A completion value that predates the produced head must not make the encoder appear to have more than one segment of lead. Rereading completion after the manifest read is not enough on its own, because a stale produced head can then sit below a newer completion value.

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: cea5d0fe-9ebe-4e6e-8b4a-064f768e7c5e
Commits

Reviewing files that changed from the base of the PR and between 975bbf4 and 791ee34.

Files selected for processing: 18

  • contracts/api/v2/openapi.json
  • contracts/api/v2/route-inventory.json
  • docs/architecture/playback-protocol-v3.md
  • docs/architecture/worker-http-protocol.md
  • docs/design/2026-10-17-buffering-quality.md
  • internal/api/handlers/playback_connection.go
  • internal/api/handlers/playback_connection_test.go
  • internal/api/handlers/playback_v3.go
  • internal/apiv2/worker_streaming_test.go
  • internal/playback/copy_keyframe_plan.go
  • internal/playback/transcode.go
  • internal/playback/transcode_manager.go
  • internal/playback/transcode_manifest_test.go
  • internal/telemetry/node_http.go
  • internal/transcodenode/protocol_registry.go
  • internal/transcodenode/server.go
  • internal/transcodenode/server_test.go
  • internal/transcodenode/testdata/media_routes.txt

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

Comment thread internal/api/handlers/playback_v3.go Resolved
…e's server-HLS measurement

An FFmpeg that exited with an error read as finished, so a client that had
caught up with its output and then stalled on the dead encoder taught the
device a bandwidth limit. A failed encoder is now judged like a running
one: no lead means the client waits on the server. A finished encoder still
never counts, since every segment is there to fetch.

The buffering-quality design now says that Apple's relay timing on server
HLS is slow-link evidence only. Apple still sends no throughput_kbps sample
there, and the lowering's observed_throughput_kbps follows the slow-link
timing rule.
@silo-kody

silo-kody Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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: ffafedbd-9266-4759-895a-dabeeae2faa7
Commits

Reviewing files that changed from the base of the PR and between 791ee34 and 2cfc29a.

Files selected for processing: 8

  • contracts/api/v2/openapi.json
  • docs/architecture/playback-protocol-v3.md
  • docs/architecture/worker-http-protocol.md
  • docs/design/2026-10-17-buffering-quality.md
  • internal/playback/copy_keyframe_plan.go
  • internal/playback/transcode.go
  • internal/playback/transcode_manifest_test.go
  • internal/transcodenode/protocol_registry.go

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

observed_throughput_kbps takes 100 to 1,000,000, and the slow-link evidence
section set no floor, so it read as if a client measuring 50 kbps would send a
value the server rejects. Both clients already drop a reading under 100 kbps,
as for a throughput_kbps sample, so that lowering goes without a source.
@silo-kody

silo-kody Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 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

… is unseen

The replan already probes the session's transcode node and egress proxy, but
the output-bound check consulted that answer only for a remote HLS transcode.
A progressive remux on a node the replan found dead, and any delivery through
an egress proxy that stopped answering, still taught the device a limit for a
stall the server caused. An HLS session whose transcode ran neither on this
replica nor on a node (being rebuilt, or run by another replica) also read as
not bound, unlike a remote node that answers 404.

Any node the replan found unreachable now counts the stall as the server's, as
does an HLS session with no transcode the replica can see. The protocol doc
lists these unknowns, drops the claim that a transcode on another replica still
records, and says an Auto rebuffer lowering carries observed_rebuffer only with
slow-link evidence.

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

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of baa2b4f: the approach holds, and three gaps remain where the check says "not bound" for a stall it can't attribute to the link. Each one falls back to today's behavior, which records the limit. None is a regression, but two go against the rule this PR sets: when the answer is unknown, the stall counts as the server's. Two are inline. The third, a docs gap, sits outside the diff, so it's here:

Low (docs): docs/architecture/playback-protocol-v3.md, the paragraph starting "A transcode is a single HLS rendition" (around line 2296), still says every Auto rebuffer lowering sends bandwidth_estimate_source: "observed_rebuffer" and records a limit. That contradicts the slow-link evidence rule this PR adds to the buffering-quality design: without evidence, the lowering goes with no source and records nothing. A client author reading the protocol doc alone would keep sending the source on every stall. The learned-limit section's last sentence ("A transcode running on another API replica … still records") also needs updating once the second inline fix lands.

I'm fixing all three in a commit on this branch, so there's no need to change them yourself.

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

@silo-kody

silo-kody Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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: ee2074f6-807c-42bc-b4f5-871f8ed752b2
Commits

Reviewing files that changed from the base of the PR and between 2cfc29a and abfadd1.

Files selected for processing: 4

  • docs/architecture/playback-protocol-v3.md
  • docs/design/2026-10-17-buffering-quality.md
  • internal/api/handlers/playback_connection.go
  • internal/api/handlers/playback_connection_test.go

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

… when nothing records

A local FFmpeg crash tears down the transcode and the playback session. When
that lands while a stall replan is running, the output-bound check found no
session and no transcode, read that as not bound, and the replan stored a
24-hour limit just before it failed. A session that is gone is now unknown,
like a node that no longer runs the transport, so nothing is learned.

A replan with no device or no connection key cannot store a limit, so it no
longer waits up to two seconds on a node to ask. The skip log names the server
rather than the transcode, since an unreachable egress proxy also skips.

The slow-link evidence rule keeps the earlier one the Auto lowering row lost: a
reading taken before the network changed while the plan played is no evidence.

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

silo-kody Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: 643ab5b4d. The branch had no conflicts with main, and main's changes since the merge base don't touch this PR's code. I didn't merge main in.

Fit: 9/10 · Readiness: 9/10 · ready (assuming CI is green)

Fit. Wrong learned limits are a core playback bug: a heavy burn-in teaches the device a day-long cap, and later titles that should direct play start as low-quality transcodes. The fix sits where the knowledge lives. The server knows whether its own encoder paced the client, and the node knows its own segment acknowledgements. It adds no setting. The extra node read happens only on a replan that would record, and every unknown answer falls back to not learning, which costs only memory. The one new surface is an internal, signed, read-only worker route with a concrete caller.

Readiness. I showed the behavior live and covered it with tests that fail without the change:

  • Live, on a Silo dev deployment with a single API server and a local transcode: a 1080p H.264 source transcoded to 720p, with the server's CPU limited so each 2-second segment took about 4.5 seconds.
    • A client that kept up with the encoder sent an Auto observed_rebuffer replan. Main stored a 1400 kbps limit for 24 hours. This branch stored nothing and logged that it skipped the record.
    • A slow-link control on this branch (the client stops fetching while the encoder runs ahead) still stored the limit.
  • Tests that fail on the base:
    • TestOutputBoundRouteAnswersForTheNodesSessions fails on main.
    • The four cases added in review to TestTranscodeOutputBoundAsksTheRemoteNode fail on the head before each fix.
    • TestTranscodeOutputBoundsClient and the PR's handler test don't build on main, so they guard the change but aren't evidence of the fix.
  • The learned-limit DB contract tests pass against a migrated Postgres 18 database.

What remains is low and bounded. Each item falls back to recording, which is main's behavior. None is a regression:

  • The server reads the encoder's lead when the replan arrives, not when the stall happened.
  • A lost relay acknowledgement can make a caught-up client look behind.
  • A restart can land between two reads.

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

Addressed in review

Pushed to this branch in abfadd1db and 643ab5b4d:

  • A node on the session's route that the replan already found unreachable (an egress proxy, or a remote progressive remux's node) now counts as the server's stall, whatever the delivery.
  • An HLS session with no transcode on this replica and none on a node now counts as unknown. That covers a transcode being rebuilt, one run by another API replica, and a session torn down by a crash while the replan ran. The cross-replica risk in the description now fails safe instead of recording.
  • A replan with no device ID or connection key no longer waits on a node, since it can't store a limit.
  • Docs: the protocol doc's Auto-lowering paragraph now says observed_rebuffer goes only with slow-link evidence. Its list of unknown answers matches the code. The slow-link evidence rule again says a reading taken before a network change is no evidence. The rewritten Auto-lowering row had dropped that.
  • The skip log names the server rather than the transcode.

The earlier bot threads were already settled, and I agree with each outcome. The failed-encoder fix holds, and both declines are sound: a client that downloads nothing while segments wait is slow-link evidence, and a newest segment still in flight may stay unfetched.

Left for the maintainers

Validated features

Unavailable. The validation board couldn't be read from this session (missing read:project scope). Judging from source alone, the change touches only the learned-limit record on Auto stall replans. It doesn't touch playback start, seek, the planner or the transcode itself.

User manual

If playback keeps buffering on siloserver.org says Silo "remembers the slower speed for this device and network for 24 hours" after lowering. With this change it doesn't when the server caused the buffering. I recommend a siloserver.org issue for one sentence on docs/watch-movies-and-series, for example: "When the buffering came from the server, such as a slow transcode, Silo lowers this title but doesn't remember the limit."

Apple and Android

This is a server change, so it needs no client change to take effect. The client halves of the slow-link evidence rule are silo-android#1011 and silo-apple#1237, and the web half is #4643.

Council review

Member Round 1 (baa2b4f) Round 2 (abfadd1)
Sol (gpt-6.2-sol, xhigh) 6/10 8/10
Opus (claude-opus-5-5, high) 8/10 8/10
Gemini (gemini-4-neon, xhigh) 7/10 9/10

Round 1 found the unreachable-route and missing-runtime gaps, fixed in abfadd1db. Round 2 found the vanished-session case, the needless node read and the dropped network-change rule, fixed in 643ab5b4d. The remaining items are the low ones listed under Readiness.

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

@Quick104
Quick104 merged commit f503d7e into Silo-Server:main Nov 22, 2026
18 of 20 checks passed
blurbery added a commit to blurbery/silo-server that referenced this pull request Nov 22, 2026
Main gained Silo-Server#4640, which skips recording a lowering the server's own
transcode paced. Both checks now run in applyLearnedLimit: the empty
device/key skip first, then this branch's reading check, which reads the
database, then Silo-Server#4640's encoder check, which may ask a node. A provider:
key skips only the reading check, never the encoder check. The API
description, protocol doc and design doc say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
blurbery added a commit to blurbery/silo-server that referenced this pull request Nov 22, 2026
The design doc still said a provider: key always records a lowering. Since
Silo-Server#4640, a stall the server's own transcode paced, or whose cause is unknown,
is not recorded for any key.

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

Labels

bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P1 Core-path bug; painful workaround — next after P0 size/XL 500–999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants