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(playback): mark an item watched when playback reaches its end credits - #5133
Other clients: Apple Silo-Server/silo-apple#1255 (offline progress and the series-return check still use a local 90%); Android Silo-Server/silo-android#1037 (offline progress); Roku N/A (no downloads; the server decides watched state for streaming)
Viewers often stop a movie or episode once the end credits start. With the default "Mark watched at" of 90%, a title with more than a few minutes of credits stays in Continue Watching, isn't marked watched, and Next Up doesn't move on. Admins work around it by lowering the percentage, which also marks titles without long credits watched too early. Silo usually knows where the credits start, from local credit detection, a manual marker, or a marker provider, so it can use that instead.
When the played file has a stored credits marker inside its end-credits window, reaching it now marks the title watched, whichever comes first of the credits and the percentage. There is no new setting. Web admin explains the rule under "Mark watched at".
Approach
userstore.ProgressThresholds gains the played file's credits start, and its new Watched method is now the single rule for "this position finishes the item". ResolveProgressState and every inline copy of the percentage check use it: native progress and stop, realtime stops, admin playback history, watch history rows, multi-episode span marking, notification interest tracking, and Jellyfin-compatible progress and scrobbles. Completion is decided before the min-resume floor, so credits that start under a raised floor still finish the play.
The credits come from the file the session streams, on the same timeline as the duration: the file row native playback already loads, or the played version on the Jellyfin path. Only credits starting in the end-credits window count (markers.CreditsLimits.EndCreditsStart, using the existing placement limits), so a misplaced legacy marker can't finish an item early. Both use the item kind's window. On the Jellyfin path, PlaybackInfo resolves each source's end-credits start, from every credits occurrence and with the item's kind, and stores that value on the source, so a play session reloaded from the durable store keeps it. Progress reports and stop scrobbles use credits only from a version the play identifies, not from the first listed one they fall back to.
A finished stop now reaches watch-sync providers as a play to the end. Silo decides completion, while Trakt infers it from progress at 80%, so without this a credits stop at 76% would be watched in Silo and paused on Trakt.
Not covered, and kept on the percentage rule:
Offline downloads and /sync/progress writes: they carry the item but not the file that played.
Provider markers under "on demand" online-marker storage: these are never stored. The default "stored" mode saves them when playback starts.
Sessions that stream another file than the one requested, such as a lower-bitrate version or the next part of a multipart title, and Jellyfin stops whose played version was never identified.
Validation
Live, native playback: on a Silo dev sandbox, an episode with stored credits was played through the v3 API and stopped inside its credits at 85%. On origin/main the progress and history rows stay unfinished. On this branch both are finished and the resume point is cleared. A control episode without credits, stopped at the same 85%, stays unfinished.
Live, web admin: the Playback settings page shows the new help line at desktop, tablet, and phone widths.
Tests: tests for the native stop, the Jellyfin progress report, and the watch-sync stop event fail on origin/main and pass here; the native stop test also covers a session streaming a substituted version. A table test of ResolveProgressState covers credits under a raised floor and credits at the end of the file, and a test of the Jellyfin source build covers the item kind's window and the last credits occurrence. The touched Go packages, the admin settings web tests, tsc, and make lint-changed pass.
Not run live: the Jellyfin-compatible path and a real Trakt or MDBList account. Those are covered by the tests above.
Behavior change for everyone, with no opt-out: a title with a stored credits marker is marked watched once playback reaches the credits, even when an admin set "Mark watched at" to 100%. A viewer who stops during the credits before a post-credits scene finds the title watched with no resume point, as already happens past 90%.
Credits mismatched to the file: if the stored credits are wrong for the file, the title finishes early. Placement limits keep that within the file's end window.
Jellyfin play sessions started before this deploy: they have no stored end-credits value and keep the percentage rule until the next play.
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
Plan round (before implementing): Sol, Opus, and Gemini at medium. Opus's cut removed a per-session copy of on-demand provider credits in favor of the stored marker. Sol's and Gemini's checks added completion before the min-resume floor, credits from the same file as the duration, and the played version's stored credits on the Jellyfin path.
Background review: 3 rounds, last reviewed 65fb066.
Fixed: the Jellyfin path stores each source's end-credits start with the item's kind and every credits occurrence (Opus's window finding, Sol's and a bot's reload finding); a stop scrobbled for a reaped session names its file only from an identified source (bot, 4be60ca); native paths count credits only from the file the session streams (bots, 65fb066); a detached Jellyfin stop that never identified its version keeps its guess out of the streamed file, so neither its scrobble nor its history applies credits (round 3, all three members, and a bot, 672a89c); sessions on a longer timeline skip credits (bot, 811d223). Answered: a report naming a different cut than the one streaming, idle cleanup sending a finished stop before a late client stop, a marker edited mid-play, a substituted version's own credits, and Jellyfin plays negotiated before the deploy follow paths that already behaved this way past the percentage, so they're unchanged. The visual review's wording suggestions (say "skip marker", say "marked watched") were kept as is, since "credits marker" is the term web admin already uses for these markers, and the line already says the credits also count.
AI Disclosure
Harness: Claude Code in T3 Code
Tool(s): Claude Code; Codex CLI and Antigravity for the council reviewers
Model(s): claude-opus-5-5 (implementation, code review); claude-sonnet-5-5 (code-review cleanup finder and validation check); gpt-6.2-sol, claude-opus-5-5, gemini-4-neon (council)
Involvement: Fully AI-generated; not yet verified by a person
Adversarial review: a plan round, a high-level code review that changed the Jellyfin version handling, the credits window, and watch-sync reporting, a simplify pass, and the council review above.
Mark playback items as watched when reaching end credits
Adds end-credits completion to watch-state resolution: ProgressThresholds gains a credits-start position and a shared Watched predicate, and CreditsLimits.EndCreditsStart computes the eligible marker position from the file's tail window (internal/userstore/threshold.go, internal/markers/credits_placement.go)
Native playback progress, stops, realtime stops, and admin history use file-aware thresholds via the new PlaybackHandler.playbackThresholdsForFile, which only applies credits completion when the streamed file and timeline are identified
Jellyfin compatibility sources carry a computed end-credits start; progress reports, scrobbles, and stops complete at credits only when the played version is identified, while fallback/guessed sources keep percentage-only completion (internal/jellycompat/)
Completed stops below the minimum-resume floor are no longer discarded when they are at credits (ResolveProgressState), and completed stop events are sent to plugin providers as a play at 100% of the duration
Updates admin/Jellyfin/markers API docs, adds a watched-threshold description in playback settings, and refreshes generated locales
Risk: ResolveProgressState in internal/userstore/threshold.go now checks the watched predicate before the minimum-resume floor, so stops previously skipped as below-floor may now count as completed when credits markers exist
…edits
A title whose end credits run past the remaining 10% stayed in Continue
Watching when the viewer stopped once the credits began. When the played
file has a stored credits marker in its end-credits window, reaching it now
finishes the item, whichever comes first of the credits and the watched
threshold. Native playback, realtime stops, admin and watch history,
notifications, and Jellyfin-compatible reports share the one rule, which
also decides completion before the min-resume floor.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… finished stops in full
Address review of the credits rule:
- Use the item kind's credits window where it is known (native playback),
and either kind's on the Jellyfin path, which doesn't record it.
- On the Jellyfin path, count credits only from a version the play
identifies, not the first listed one guessed when nothing does.
- Report a finished stop to watch-sync providers as a play to the end, so
providers that judge completion from progress record it too.
- Explain the credits rule under "Mark watched at" in web admin, and in
the admin, Jellyfin, and marker API docs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
No actionable comments were generated in the recent review.
Walkthrough
Playback completion now recognizes eligible end-credit markers in addition to the watched threshold. This applies across API playback, compatibility reports, progress state, and watch-sync events. Documentation and localized settings text describe the credits-based completion rule.
The shared watched-state check accepts a valid credits start. Progress resolution checks completion before applying the minimum-resume skip rule. Playback-stop recording and notification progress state use the shared check.
File-aware API playback completion internal/api/handlers/playback.go, internal/api/handlers/playback_realtime.go, internal/api/handlers/playback_test.go, docs/admin-api.md
API playback paths use file-specific thresholds when the timeline duration matches the file duration. Tests cover stops inside credits and cases that remain incomplete. The API documentation includes credits in its completion rule.
Compatibility playback resolves the played version and applies credits thresholds only when that version is identified. Tests cover completion at the identified version’s credits and non-completion for other or unidentified versions.
Completed stops with a positive duration use the full duration as the outgoing event position. Tests check the position and completion percentage for completed and unfinished stops.
Credits behavior documentation and settings docs/markers-api.md, web/src/pages/admin-settings/PlaybackSettings.tsx, web/src/locales/keys.ts, web/src/locales/*.json, .silo-translations
Marker documentation describes credits placement and watched-state behavior. The playback setting displays a localized description, and locale catalogs include that text.
Playback Transport Message Localization
Layer / File(s)
Summary
Superseded transport message translations web/src/locales/keys.ts, web/src/locales/*.json
The translation-key catalog and locale catalogs add a message for playback continuing on the current stream after a transport is superseded.
sequenceDiagram
participant JellycompatStreams
participant ReportedSource
participant SourceThresholds
participant ProgressThresholds
JellycompatStreams->>ReportedSource: resolve source and identification status
JellycompatStreams->>SourceThresholds: provide source and identification status
SourceThresholds-->>JellycompatStreams: return source-specific thresholds
JellycompatStreams->>ProgressThresholds: evaluate reported position
Loading
Suggested reviewers:blurbery, rhainland
Merge Risk: Minimal · up to 672a8
This change marks a title watched when playback reaches a stored end-credits marker, or the configured percentage, whichever comes first. Credits apply only when the played file and its timeline are known, so substituted or guessed versions and offline syncs keep the percentage rule. No concrete defect remains that should block merging.
Security architecture risk: Minimal · up to 672a8
The completion rule changes when playback is considered finished, but the inspected paths retain the existing user and profile ownership. Credits are restricted to eligible markers and identified playback versions. No introduced security or failure-containment concern was established.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The incremental effect in the inspected paths is earlier completion of the existing session identity's progress, history, same-file episode span, and downstream watch-sync events. Client-reported position already had authority to complete playback through the percentage threshold; the credits rule does not establish new cross-user authority.
Trust Boundaries and Controls
observed — Compatibility playback distinguishes an identified source from a first-listed fallback. Unidentified sources supply no credits threshold. After reaping, an unidentified fallback leaves MediaFileID unset and places its history guess in RequestedMediaFileID; the native threshold guard rejects using that guessed file's credits.
Resilience and Maintainability Implications
observed — Native transport cleanup remains independent of whether credits complete the item. Finalization closes transport and removes proxy grants and node recipes before recording stop history; a genuine user stop also retains the existing stream-deny step. The inspected threshold change does not condition these revocations on successful completion persistence.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: playback marks an item watched when it reaches the end credits. The changeset adds credits-start completion logic in the playback, progress, and Jellyfin-compatibilit…
Description check
The description explains the problem (viewers stop at the end credits, and the 90% threshold keeps titles in Continue Watching), the approach (a shared Watched predicate, file-aware credits thresholds…
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.
Full details: Title check
Explanation
The title states the main change: playback marks an item watched when it reaches the end credits. The changeset adds credits-start completion logic in the playback, progress, and Jellyfin-compatibility paths, plus the matching docs and locale strings. The title is specific and uses the conventional commit format.
Full details: Description check
Explanation
The description explains the problem (viewers stop at the end credits, and the 90% threshold keeps titles in Continue Watching), the approach (a shared Watched predicate, file-aware credits thresholds, and Jellyfin source credits start), validation, and risks. These match the changes in the diff, including the playback, userstore, markers, jellycompat, watchsync, and locale files.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
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: 5ed5de0a-2303-42e2-9669-aa4ff6207420
Commits
Reviewing files that changed from the base of the PR and between 74032ee and 672a89c.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
One low-severity finding, inline. I checked the rest and found no problems: completion is decided before the min-resume floor in the two store backends, offline sync, and both watchstate stop paths. The native heartbeat, stop, realtime stop, admin history and span marking all build thresholds from the loaded file. Notifications interest tracking follows Watched. The watch-sync full-position override applies only to completed stops.
This review was written by an AI model (claude-opus-5-5).
The reason will be displayed to describe this comment to others. Learn more.
Later stops cannot advance an existing play to credits completion
An earlier incomplete stop prevents a later stop from advancing the play's completion, watched time, or end time because RecordPlaybackStopOnce ignores existing history IDs. Use a monotonic history upsert and write hints only when the stop records or advances the play.
File internal/watchstate/service.go, line 280:
Later stops cannot advance an existing play to credits completion
A later stop can now reach the credits marker and calculate completion here, but `RecordPlaybackStopOnce` treats an existing history ID as an unconditional no-op. If an earlier stop recorded the play as incomplete, the later stop cannot advance its completion, watched time, or end time. Use a monotonic history upsert that advances the existing play when appropriate, and write hints only when that stop records or advances it.
Kody rule violation: [Make playback finalization monotonic and consume dispatch state only after success](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/d467b6b4-45c0-4c35-be95-d699f19a5c91?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
This predates the PR: with the percentage rule alone, a second stop of the same Jellyfin play that passes 90% after an earlier stop below it hits the same ErrHistoryEntryExists no-op. This change only adds another way to cross into completed, so it's out of scope here; I'm leaving the thread open for the maintainer and noting it as a possible follow-up once it's confirmed on main.
The reason will be displayed to describe this comment to others. Learn more.
That scope assessment makes sense: if the same later-stop behavior occurs under the existing percentage rule on main, it is a pre-existing issue rather than a regression introduced by this PR. The new credits threshold adds another way to encounter it, but does not appear to cause it.
Leaving the thread open for the maintainer and considering a follow-up after confirming the behavior on main is reasonable.
…uilds it
A Jellyfin play session didn't know whether its item was a movie or an
episode, and reloading it from the durable store dropped every credits
occurrence but the first. PlaybackInfo now resolves where each source's
end credits start, with the item's own window and every occurrence, and
stores that one value on the source; progress reports and stop scrobbles
read it. Sessions stored before this keep the percentage rule.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
A stop scrobbled after the upstream session was reaped took its file from
the first listed source when nothing identified the played version, and
the scrobble then judged that cut's credits as the played one's.
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
❌
⚠️ 5 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
Retain distributed firing claims through their own validity windows
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
When v3 substituted another file for the requested one, such as a
lower-bitrate version or the next part of a multipart title, the native
paths judged the streamed position against the requested file's credits.
Those sessions keep the percentage rule.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
I looked at the round-3 changes (4be60ca, 74032ee, 65fb066) and the code that calls them. The native guard in 65fb066 is consistent across all four callers of playbackThresholdsForFile (heartbeat, stop, realtime stop, admin history). Each session constructor and the detached attempt-row session carry both MediaFileID and RequestedMediaFileID, so the guard sees the file the session actually streams. The docs changes match the code.
One finding, inline: when the stop arrives after the native session was reaped, 4be60ca's fix is undone one step later, in compatStopSnapshot.
This review was written by an AI model (claude-opus-5-5).
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Credits must come from the file the session plays. · playback.go:1055-1068
internal/api/handlers/playback.go:1055-1068 Minor · Functional Correctness · Quick win
Credits must come from the file the session plays.
persistProgress (playback.go:1055-1068) and persistStopAndHistory (playback.go:1113-1124) load the requested file and apply its end-credits marker. When a session streams a different file, the position belongs to the streamed file, but the credits window comes from the requested file. The duration check does not catch this, because duration is taken from the loaded file itself.
A played file can then be marked watched at a credits start from another version. If the markers differ, completion can occur early or late. The fix must take the credits window from session.MediaFileID. Skipping credits when the IDs differ would fall back to the percentage rule and remove the credits completion this change adds for substitute plays.
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: 211cc120-abc3-4851-9b46-dfdf393cfe74
Commits
Reviewing files that changed from the base of the PR and between 24d4e81 and 74032ee.
Files skipped from review as they are similar to previous changes: 1
docs/markers-api.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Checked the round-3 commits (4be60ca, 74032ee, 65fb066) and their callers. playbackThresholdsForFile (65fb066) and the doc updates (74032ee) hold up. One verified issue remains: compatStopSnapshot in internal/jellycompat/streams.go:2034 still calls compatScrobbleSource, which immediately overwrites the MediaFileID = 0 that 4be60ca left unset on an unidentified fallback session, defeating the fix.
AI-assisted review generated with Gemini 4 Neon (gemini-4-neon).
…file only
The stop snapshot after a reap refilled the session's file with the first
listed version for the detached history write, and the stop scrobble then
took that guess as the played version and applied its credits. The
scrobble now uses the file the fallback identified; history keeps the
guess as before.
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
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
❌
⚠️ 5 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
Retain distributed firing claims through their own validity windows
On the outside-diff note about credits from the played file (playback.go 1055–1068 and 1113–1124): since 65fb066, playbackThresholdsForFile applies credits only when the loaded file is the one the session streams (session.MediaFileID), and since 811d223 only on that file's own timeline. A session that streams a substituted version keeps the percentage rule. That's how every session behaved before this PR, so substitute plays lose nothing they had. Reading the streamed copy's markers instead would add a second file lookup to every heartbeat. It's listed under "Not covered" in the description.
…treamed file
A Jellyfin stop handled after the native session was reaped, for a play
that never identified its version, recorded the first listed version as
the streamed file, so native history applied that version's credits. The
guess now goes in RequestedMediaFileID, which history loads, and the
streamed file stays unknown; credits apply only to a known streamed file.
This replaces the scrobble-only workaround from 1d6b9a0.
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
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
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 requestgoPull requests that update go codepriority: P2Limited scope, workaround exists, or polishsize/XL500–999 added + deleted lines (all files); change volume, not priority.
1 participant
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: N/A
Validation tasks: none
Other clients: Apple Silo-Server/silo-apple#1255 (offline progress and the series-return check still use a local 90%); Android Silo-Server/silo-android#1037 (offline progress); Roku N/A (no downloads; the server decides watched state for streaming)
Viewers often stop a movie or episode once the end credits start. With the default "Mark watched at" of 90%, a title with more than a few minutes of credits stays in Continue Watching, isn't marked watched, and Next Up doesn't move on. Admins work around it by lowering the percentage, which also marks titles without long credits watched too early. Silo usually knows where the credits start, from local credit detection, a manual marker, or a marker provider, so it can use that instead.
When the played file has a stored credits marker inside its end-credits window, reaching it now marks the title watched, whichever comes first of the credits and the percentage. There is no new setting. Web admin explains the rule under "Mark watched at".
Approach
userstore.ProgressThresholdsgains the played file's credits start, and its newWatchedmethod is now the single rule for "this position finishes the item".ResolveProgressStateand every inline copy of the percentage check use it: native progress and stop, realtime stops, admin playback history, watch history rows, multi-episode span marking, notification interest tracking, and Jellyfin-compatible progress and scrobbles. Completion is decided before the min-resume floor, so credits that start under a raised floor still finish the play.The credits come from the file the session streams, on the same timeline as the duration: the file row native playback already loads, or the played version on the Jellyfin path. Only credits starting in the end-credits window count (
markers.CreditsLimits.EndCreditsStart, using the existing placement limits), so a misplaced legacy marker can't finish an item early. Both use the item kind's window. On the Jellyfin path, PlaybackInfo resolves each source's end-credits start, from every credits occurrence and with the item's kind, and stores that value on the source, so a play session reloaded from the durable store keeps it. Progress reports and stop scrobbles use credits only from a version the play identifies, not from the first listed one they fall back to.A finished stop now reaches watch-sync providers as a play to the end. Silo decides completion, while Trakt infers it from progress at 80%, so without this a credits stop at 76% would be watched in Silo and paused on Trakt.
Not covered, and kept on the percentage rule:
/sync/progresswrites: they carry the item but not the file that played.Validation
origin/mainthe progress and history rows stay unfinished. On this branch both are finished and the resume point is cleared. A control episode without credits, stopped at the same 85%, stays unfinished.origin/mainand pass here; the native stop test also covers a session streaming a substituted version. A table test ofResolveProgressStatecovers credits under a raised floor and credits at the end of the file, and a test of the Jellyfin source build covers the item kind's window and the last credits occurrence. The touched Go packages, the admin settings web tests,tsc, andmake lint-changedpass.Evidence: https://evidence.siloserver.org/r/silo-server/watched-at-credits/
Risks
Follow-ups
Checklist
Council review
Plan round (before implementing): Sol, Opus, and Gemini at medium. Opus's cut removed a per-session copy of on-demand provider credits in favor of the stored marker. Sol's and Gemini's checks added completion before the min-resume floor, credits from the same file as the duration, and the played version's stored credits on the Jellyfin path.
Background review: 3 rounds, last reviewed 65fb066.
Visual review: 1 round, captures from 24d4e81
Fixed: the Jellyfin path stores each source's end-credits start with the item's kind and every credits occurrence (Opus's window finding, Sol's and a bot's reload finding); a stop scrobbled for a reaped session names its file only from an identified source (bot, 4be60ca); native paths count credits only from the file the session streams (bots, 65fb066); a detached Jellyfin stop that never identified its version keeps its guess out of the streamed file, so neither its scrobble nor its history applies credits (round 3, all three members, and a bot, 672a89c); sessions on a longer timeline skip credits (bot, 811d223). Answered: a report naming a different cut than the one streaming, idle cleanup sending a finished stop before a late client stop, a marker edited mid-play, a substituted version's own credits, and Jellyfin plays negotiated before the deploy follow paths that already behaved this way past the percentage, so they're unchanged. The visual review's wording suggestions (say "skip marker", say "marked watched") were kept as is, since "credits marker" is the term web admin already uses for these markers, and the line already says the credits also count.
AI Disclosure
🤖 Generated with Claude Code
Note
Mark playback items as watched when reaching end credits
ProgressThresholdsgains a credits-start position and a sharedWatchedpredicate, andCreditsLimits.EndCreditsStartcomputes the eligible marker position from the file's tail window (internal/userstore/threshold.go, internal/markers/credits_placement.go)PlaybackHandler.playbackThresholdsForFile, which only applies credits completion when the streamed file and timeline are identifiedResolveProgressState), and completed stop events are sent to plugin providers as a play at 100% of the durationResolveProgressStatein internal/userstore/threshold.go now checks the watched predicate before the minimum-resume floor, so stops previously skipped as below-floor may now count as completed when credits markers existMacroscope summarized 672a89c.