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
fix(playback): don't learn a buffering limit that the connection's measured speed contradicts - #4475
Closes#4468
Related issue: N/A
Validation tasks: none
Other clients: N/A (no client change needed; Apple, Android, Roku and Web already handle a lowered plan that carries no bandwidth_limit)
When a start stalls because the server is slow, for example while a sleeping disk spins up, the client lowers Auto and reports the slow throughput as observed_rebuffer. The server keeps that figure as the device's learned limit for 24 hours, even when the same connection has a recent speed test or playback sample many times faster. In #4468 a Shield on a link measured at 114 Mbps (probe) and 174.6 Mbps (playback) learned 2174 kbps, and the next 4K title on Auto played as a 540p transcode.
With this change the server still plans that request at the lowered figure, but it no longer stores a lowering that the connection's current reading contradicts by more than 10 times. The next title plans with the reading again.
Approach
Before applyLearnedLimit records an observed_rebuffer lowering, it reads the connection's current reading: the higher of the probe and the playback sample within the reading lifetime (playback.bandwidth_probe_max_age_days, 7 days by default), the same reading the Auto budget uses. If that reading is more than 10 times the lowering, nothing is recorded, any earlier limit stays as it was and is not renewed, and the server logs learned limit not recorded: the connection's reading contradicts it with both figures.
The ratio is wide on purpose. Wi-Fi congestion or a probe that overstated the link usually stays well inside 10 times; a link measured 50 times faster than the stall did not cause it. The issue's readings were 24 to 25 hours old, so tying the check to the 24-hour limit lifetime instead of the reading lifetime would not have fixed it.
A provider: connection key is exempt and always records the lowering. That key follows a device across networks, so a reading taken at home doesn't speak for a stall on another network.
The Android client follows the buffering-quality spec here: its throughput meter excludes time to first byte and applies the 1,000 ms rule. The gap is in the spec, which counts a slow read after the first byte (a disk spinning up mid-request) as slow-link evidence, so the guard belongs on the server, where every client's lowering goes through it. No client change is needed.
docs/architecture/playback-protocol-v3.md and the learned-limit section of the buffering-quality design describe the rule.
Validation
New DB contract test (listed in scripts/ci/db-contracts.txt) uses the issue's figures. It fails on main (the 2174 kbps limit is stored) and passes on this branch. It also covers: an uncontradicted lowering is still learned, a contradicted lowering leaves an earlier limit unrenewed, a provider key still learns, and readings older than the reading lifetime don't block learning.
Existing learned-limit, connection budget and connectionstore DB tests pass locally against Postgres 18.
Same scripted API sequence against a fresh local server and database for each build, from the local connection with one device ID: an automatic probe result (114028 kbps, lower bound, ethernet), an Auto start carrying observed_rebuffer 15484 with observed_throughput_kbps 2174 (standing in for the stalled start), GET /api/v2/playback/connection, then a fresh Auto start of the same 20 Mbps 1080p H.264 test file with no estimate. Before is main at 651e55a, after is this branch at 44b91c3 (the later commit only names a string constant).
Step
Before
After
Lowering start
540p transcode, bandwidth_limit 2174
540p transcode, no bandwidth_limit
learned_limit
2174 kbps for 24 hours
null
auto_budget_kbps
1739
91222
Next title on Auto
540p transcode at 1524 kbps, quality_bandwidth_limit
direct play of the 1080p source
Risks
A device on one network whose link really drops more than 10 times below its kept reading (for example weak Wi-Fi in another room after a 200 Mbps sample near the router) no longer learns that limit. Each title then starts high and lowers again on its own until a Test speed replaces the reading or the reading ages out. An automatic test keeps the playback sample, so it doesn't reset this.
A contradicted limit stored before this change ships still applies until its 24 hours run out, or until a reset or a faster Test speed clears it.
The guard needs a current reading. A device with no speed test or playback sample in the reading lifetime still learns a stall the server caused, as before.
One extra row read per observed_rebuffer request, which is rare.
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.
AI Disclosure
Harness: Claude Code (desktop app)
Tool(s): Claude Code
Model(s): claude-opus-5-5
Involvement: AI-assisted with Claude Opus. I directed the task and designed the work.
Adversarial review: an independent review agent read the diff, the call sites and the buffering-quality contract. It found no correctness bugs. Its points on provider keys, doc wording and test coverage are addressed in this PR.
Note
Fix learned buffering limits to ignore lowerings contradicted by connection readings
A proposed learned limit is now recorded only when the connection's current measured reading does not contradict it, and the stall is not server-paced. The request still plans at the lower of the sent estimate and observed throughput, so playback behavior is unchanged.
Adds api.handlers.PlaybackHandler.observeLearnedLimit and readingContradicts in playback_connection.go, plus connectionstore.Contradicts and SpansNetworks helpers in store.go. A reading contradicts when it exceeds the proposed limit by more than a configured ratio (10x).
Provider connection keys skip the reading check, since those connections span networks.
Adds a database contract test TestContradictedLoweringIsNotLearnedDB covering contradicted lowerings, renewals, provider paths, and expired readings. Registered in db-contracts.txt.
Behavioral Change: an existing stored limit is no longer renewed by a contradicted lowering; check applyLearnedLimit and the Contradicts ratio in connectionstore if learned limits behave unexpectedly.
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.
No actionable comments were generated in the recent review.
Walkthrough
Observed-rebuffer lowerings more than ten times below a current connection reading still affect playback planning but are not learned for connections that do not span networks. Provider paths skip the reading comparison. Server-paced and unknown-cause stalls remain ineligible for learning.
Changes: Playback Lowering Behavior
Layer / File(s)
Summary
Define and enforce the contradiction rule internal/playback/connectionstore/store.go, internal/api/handlers/playback_connection.go, docs/design/2026-10-17-buffering-quality.md, docs/architecture/playback-protocol-v3.md, contracts/api/v2/openapi.json, internal/apiv2/playback.go, web/src/api/v2/schema.ts
The connection store defines a contradiction as a positive reading strictly more than ten times the proposed limit and identifies provider keys. The handler checks current readings for connections that do not span networks, then checks server output eligibility before recording. API descriptions and documentation describe how the estimate affects planning and learning.
Validate learning and reading expiry internal/api/handlers/playback_connection_test.go, scripts/ci/db-contracts.txt
The database test checks contradicted and uncontradicted lowerings, provider paths, existing limits, expired readings, and the effect on a subsequent request. The database contract list includes the test and related buffering-quality details.
Silo-Server/silo-server#4643: The issue describes server-caused stalls lowering Auto quality and leaving a learned limit. This PR adds checks that prevent learning in specified cases.
Possibly related PRs
Silo-Server/silo-server#4640: Adds another guard on the observed-rebuffer recording path based on encoder pacing.
This change stops a one-off server stall from becoming a 24-hour learned bandwidth limit when the connection's measured speed is much higher. It is server-only and covered by a database test. No actionable merge risk remains.
Architecture risk: Low · up to 3ecac
The change affects 5 systems.
Changed systems:internal, docs, contracts, scripts, web
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — internal (service) was modified; 4 changed files map to changed impact.
observed — docs (service) was modified; 2 changed files map to changed impact.
observed — contracts (api) was modified; 1 changed file maps to changed impact.
observed — scripts (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in internal/playback/connectionstore/store.go: The connection labels remain remote and local; a provider: prefix constant is added for provider connection keys.
observed — Modified behavior in internal/playback/connectionstore/store.go: Adds the ReadingContradictsRatio constant with value 10 and documents the reading/limit comparison rule.
observed — Modified behavior in internal/playback/connectionstore/store.go: Adds Contradicts, which returns true only when both inputs are positive and reading > kbps * ReadingContradictsRatio.
observed — Modified behavior in internal/playback/connectionstore/store.go: Adds SpansNetworks, which returns whether a key starts with providerPrefix.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the server no longer learns a buffering limit that the connection's measured speed contradicts. The changeset adds a contradiction check in the learned-limit path, the…
Description check
The description states the problem from issue #4468, the approach (a 10x contradiction check against the reading within the reading lifetime, with an exemption for provider: keys), validation steps, e…
Linked Issues check
The only active direct target is #4468. Its coding requirement: a one-time server-side storage delay must not become a 24-hour learned network limit for the device when recent readings show the link i…
Out of Scope Changes check
The code changes tie to the #4468 objective. connectionstore/store.go adds ReadingContradictsRatio, Contradicts, SpansNetworks and a shared providerPrefix constant used by Key (no behavior change). pl…
Full details: Title check
Explanation
The title names the main change: the server no longer learns a buffering limit that the connection's measured speed contradicts. The changeset adds a contradiction check in the learned-limit path, the constants and helpers in connectionstore, the handler changes, and the matching docs and schema text, so the title matches the primary change.
Full details: Description check
Explanation
The description states the problem from issue #4468, the approach (a 10x contradiction check against the reading within the reading lifetime, with an exemption for provider: keys), validation steps, evidence, and risks. The rule it describes matches the handler, connectionstore, test, docs, and schema changes in the summary.
Full details: Linked Issues check
Explanation
The only active direct target is #4468. Its coding requirement: a one-time server-side storage delay must not become a 24-hour learned network limit for the device when recent readings show the link is much faster. At the reviewed head, observeLearnedLimit (internal/api/handlers/playback_connection.go) runs readingContradicts for non-provider keys before Connections.Observe. readingContradicts reads the stored probe and playback sample through currentReadings (7-day reading lifetime) and calls connectionstore.Contradicts(reading, kbps), which is true when reading > kbps*10. The issue's figures (probe 114028 kbps, sample 174593 kbps, limit 2174 kbps, readings 24 to 25 hours old) meet this condition and fall inside the reading lifetime, so the lowering is not stored. The request still plans at the lowered estimate, as the issue and PR require. The helper logs the reason. Provider keys skip only the reading check (SpansNetworks), which is a design choice disclosed in the PR. Disclosed limits: a stall with no current reading still records, and a real link drop more than 10 times below a kept reading does not record. The DB test TestContradictedLoweringIsNotLearnedDB was not run in this review; its result rests on the PR and review reports.
Full details: Out of Scope Changes check
Explanation
The code changes tie to the #4468 objective. connectionstore/store.go adds ReadingContradictsRatio, Contradicts, SpansNetworks and a shared providerPrefix constant used by Key (no behavior change). playback_connection.go routes observed_rebuffer recording through observeLearnedLimit, which applies the reading check and the existing server-paced (outputBound) check. The new DB test and its db-contracts.txt entry cover the requirement. The protocol and design docs, OpenAPI description, apiv2 comments and web/src/api/v2/schema.ts describe the same rule and match the code. No client code changed, and the PR body explains why. The server-paced check existed before this change and is not a new unrelated change. No unrelated change was found in the inspected code.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
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: 838bd869-3b6c-464a-a144-e06a2b03e54c
Commits
Reviewing files that changed from the base of the PR and between 22b5563 and 3ecac23.
Files selected for processing: 1
docs/design/2026-10-17-buffering-quality.md
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.
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: 72a92cb6-2a45-49ef-bf3f-d383f20eb351
Commits
Reviewing files that changed from the base of the PR and between 651e55a and 43e1600.
Files selected for processing: 6
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
internal/playback/connectionstore/store.go
scripts/ci/db-contracts.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.
The reason will be displayed to describe this comment to others. Learn more.
Review of 733474b. On one sandbox, the base (651e55a) stored a 2174 kbps limit for 24 hours after an automatic 114 Mbps probe and an Auto observed_rebuffer start at 2174 kbps, and the Auto budget dropped to 1739 kbps. This head stored no limit and kept the budget at 91222 kbps. TestContradictedLoweringIsNotLearnedDB fails on the base for that reason and passes here.
Three findings are inline. There is also one outside the diff:
Low: the API contract still says the server always learns the figure. The observed_throughput_kbps descriptions on the start and replan bodies (internal/apiv2/playback.go, lines 75 and 265) say the server "plans with, and learns, the lower of it and bandwidth_estimate_kbps". The design doc says the same in its summary table and its field table. With this change, a contradicted lowering is planned but not learned. I'm qualifying those four places, regenerating contracts/api/v2/openapi.json and web/src/api/v2/schema.ts, and pushing that to this branch, so there's no need to change it yourself.
The reason will be displayed to describe this comment to others. Learn more.
Maintainer decision: how wide the regression for links that really vary can be. The check compares a lowering with the connection's best reading over the reading lifetime: 7 days by default, up to 30 when an administrator raises playback.bandwidth_probe_max_age_days. Any device whose real throughput varies more than 10x on one key stops learning limits until a manual Test speed or the reading ages out. Each title then starts high, stalls and lowers again. Cases found in review:
a phone, tablet or laptop on the local key that has played near the access point and is now in a far room;
a fast Ethernet sample on local followed by Wi-Fi;
a device whose key doesn't change between networks, because it reaches the server through a host-level VPN address (a Tailscale 100.x address is hashed into one remote: key; a WireGuard 10.x address is local) or through a proxy the server doesn't trust (clientip.ForwardedClientUnknown).
Before this change, those devices learned a limit that could be wrong on the next network. Now they learn none. The issue's failure, a full day of low quality on every title, is worse than one stall per title. The new failure, though, can last up to a week and may be more common than a disk spinning up.
Options raised in review:
Keep the rule as it is. The risk is disclosed; I'm adding the VPN and proxy cases to the protocol doc.
Add a second-strike rule: record a contradicted lowering when an earlier one on the same key happened within the 24-hour lifetime. A disk spinning up is a one-off, and a bad link repeats. This needs somewhere to keep the earlier contradiction, so a column and a migration.
Also skip the check when clientip.ForwardedClientUnknown(ctx) is set, as for provider: keys.
I've left this for the maintainers to settle and haven't changed the logic.
…learned
The observed_throughput_kbps field descriptions and the design doc's
tables still said the server always learns the lowered figure. Qualify
them, and regenerate the OpenAPI artifact and web types.
The ratio's comment said Wi-Fi congestion stays well within 10x, but the
reading is the best the connection did within the reading lifetime. Say
the margin is a judgement call and that a sustained drop past it on one
key is no longer learned. The protocol doc now names devices whose key
stays the same on every network (a VPN address, an untrusted proxy), and
says a plan carries no bandwidth_limit unless a lower stored limit applies.
Co-Authored-By: Claude Opus 5.5 <[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
Reviewed head: 28a7e91. It merges current main into 3ecac23 with no conflicts. Since my last summary (d97ce20), the branch has merged #4640 and updated the docs and API descriptions to match.
Fit: 7/10 · Readiness: 7/10 — conditional (assuming CI is green)
CI on 3ecac23.Web test (1/2) failed in adminActivityPresentation.test.ts, which this PR doesn't touch. Main had that failure at the commit the branch merged, and c90e406 fixed it there. Go vet and contracts stopped inside its run step after 48 minutes with no log. Merging main and pushing 28a7e91 starts a fresh run for both.
ba48c1e and 3ecac23 fixed CodeRabbit's two findings on the provider-key wording, and I checked the new wording against the code.
TestContradictedLoweringIsNotLearnedDB fails on main (a16a247) with the reported failure: the 2174 kbps lowering comes back as a limit and is stored. It passes on this head.
The learned-limit, connection budget, seek replay and connection DB tests in internal/api/handlers, and internal/playback/connectionstore, pass against a freshly migrated Postgres 18 database with pgvector.
go build, go vet on both touched packages, make lint-changed (0 issues), make verify-apiv2-openapi and make verify-apiv2-web-types pass.
The live sandbox comparison from the last review (733474b) still holds for the reading check: the base stored the 2174 kbps limit and the head stored none. I didn't repeat it on this head, because the code changed only to add the encoder-bound check, which the DB test exercises with no node.
Left for the maintainers
Maintainer decision: the regression for links that really vary (inline thread on playback_connection.go). This is unchanged from the last summary. A device whose real speed varies more than 10 times on one connection key learns no limit until a manual Test speed runs or the best reading ages out (7 days by default). That covers far-room Wi-Fi on local, Ethernet followed by Wi-Fi, and VPN or untrusted-proxy addresses. The options are to keep the rule as disclosed, to record a repeat contradicted lowering within 24 hours (needs a migration), or to also skip the check for clientip.ForwardedClientUnknown.
Checks
Validated features: not checked. GitHub rate-limited the validation board query in this run.
No second round ran. Since round 1, the only code change is the merge with #4640, and it follows the order that round settled. All three scores rest mainly on the open decision above.
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: 2169756a-1dd8-42f0-a0de-7dd8a03d0d52
Commits
Reviewing files that changed from the base of the PR and between 43e1600 and d97ce20.
Files selected for processing: 7
contracts/api/v2/openapi.json
docs/architecture/playback-protocol-v3.md
docs/design/2026-10-17-buffering-quality.md
internal/api/handlers/playback_connection_test.go
internal/apiv2/playback.go
internal/playback/connectionstore/store.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 1
internal/playback/connectionstore/store.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.
…en the reading contradicts it
The observed_throughput_kbps descriptions said a lowering is not learned when
the connection's reading is more than 10 times higher, but a provider:
connection key always learns it.
Co-Authored-By: Claude Opus 5.5 <[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
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]>
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: 04855d85-b66e-4ec8-a39d-8daca6f4e7fb
Commits
Reviewing files that changed from the base of the PR and between ba48c1e and 22b5563.
Files selected for processing: 8
contracts/api/v2/openapi.json
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
internal/apiv2/playback.go
scripts/ci/db-contracts.txt
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 1
web/src/api/v2/schema.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 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]>
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
bugSomething isn't workinggoPull requests that update go codeimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishsize/L200–499 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
Closes #4468
Related issue: N/A
Validation tasks: none
Other clients: N/A (no client change needed; Apple, Android, Roku and Web already handle a lowered plan that carries no
bandwidth_limit)When a start stalls because the server is slow, for example while a sleeping disk spins up, the client lowers Auto and reports the slow throughput as
observed_rebuffer. The server keeps that figure as the device's learned limit for 24 hours, even when the same connection has a recent speed test or playback sample many times faster. In #4468 a Shield on a link measured at 114 Mbps (probe) and 174.6 Mbps (playback) learned 2174 kbps, and the next 4K title on Auto played as a 540p transcode.With this change the server still plans that request at the lowered figure, but it no longer stores a lowering that the connection's current reading contradicts by more than 10 times. The next title plans with the reading again.
Approach
Before
applyLearnedLimitrecords anobserved_rebufferlowering, it reads the connection's current reading: the higher of the probe and the playback sample within the reading lifetime (playback.bandwidth_probe_max_age_days, 7 days by default), the same reading the Auto budget uses. If that reading is more than 10 times the lowering, nothing is recorded, any earlier limit stays as it was and is not renewed, and the server logslearned limit not recorded: the connection's reading contradicts itwith both figures.The ratio is wide on purpose. Wi-Fi congestion or a probe that overstated the link usually stays well inside 10 times; a link measured 50 times faster than the stall did not cause it. The issue's readings were 24 to 25 hours old, so tying the check to the 24-hour limit lifetime instead of the reading lifetime would not have fixed it.
A
provider:connection key is exempt and always records the lowering. That key follows a device across networks, so a reading taken at home doesn't speak for a stall on another network.The Android client follows the buffering-quality spec here: its throughput meter excludes time to first byte and applies the 1,000 ms rule. The gap is in the spec, which counts a slow read after the first byte (a disk spinning up mid-request) as slow-link evidence, so the guard belongs on the server, where every client's lowering goes through it. No client change is needed.
docs/architecture/playback-protocol-v3.mdand the learned-limit section of the buffering-quality design describe the rule.Validation
scripts/ci/db-contracts.txt) uses the issue's figures. It fails onmain(the 2174 kbps limit is stored) and passes on this branch. It also covers: an uncontradicted lowering is still learned, a contradicted lowering leaves an earlier limit unrenewed, a provider key still learns, and readings older than the reading lifetime don't block learning.go veton both touched packages: clean.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4475/
Same scripted API sequence against a fresh local server and database for each build, from the
localconnection with one device ID: an automatic probe result (114028 kbps, lower bound, ethernet), an Auto start carryingobserved_rebuffer15484 withobserved_throughput_kbps2174 (standing in for the stalled start),GET /api/v2/playback/connection, then a fresh Auto start of the same 20 Mbps 1080p H.264 test file with no estimate. Before ismainat 651e55a, after is this branch at 44b91c3 (the later commit only names a string constant).bandwidth_limit2174bandwidth_limitlearned_limitauto_budget_kbpsquality_bandwidth_limitRisks
observed_rebufferrequest, which is rare.Checklist
AI Disclosure
Note
Fix learned buffering limits to ignore lowerings contradicted by connection readings
api.handlers.PlaybackHandler.observeLearnedLimitandreadingContradictsin playback_connection.go, plusconnectionstore.ContradictsandSpansNetworkshelpers in store.go. A reading contradicts when it exceeds the proposed limit by more than a configured ratio (10x).TestContradictedLoweringIsNotLearnedDBcovering contradicted lowerings, renewals, provider paths, and expired readings. Registered in db-contracts.txt.observed_throughput_kbpsin playback-protocol-v3.md and 2026-10-17-buffering-quality.md.applyLearnedLimitand theContradictsratio inconnectionstoreif learned limits behave unexpectedly.Macroscope summarized 28a7e91.