Skip to content

feat(markers): detect movie credits locally (best effort) - #1544

Merged
Quick104 merged 48 commits into
mainfrom
outro/c4-movie-credits
Sep 27, 2026
Merged

Quick104 merged 48 commits into
mainfrom
outro/c4-movie-credits

Conversation

@Quick104

@Quick104 Quick104 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1147
Validation tasks: changes #1148 C1; changes #1149 C1; changes Silo-Server/silo-apple#311 C1; changes Silo-Server/silo-apple#312 C1; changes Silo-Server/silo-android#321 C1; changes Silo-Server/silo-android#322 C1

Movies have no sibling episodes, so the ending-audio comparison can't find their credits, and local detection skipped movies entirely. This change detects movie credits locally, best effort, from a credits chapter or from the end-credit visuals, and leaves credits unset when neither is clear.

This is part of a stacked series that adds local credits (outro) detection on a shared media sampling package. Review and merge in order; each PR targets the previous branch.

Approach

  • Candidates: movies in movie and mixed libraries with marker detection on, at least 20 minutes long, not extras or multi-part files, and without higher-priority credits. Titles named "Ending" are not treated as credits for movies, because in films they often name the last scene.
  • Sampling: mediasample gains a Samples mode that decodes only the keyframe at or before each requested time. Samples are listed in an ffconcat list read from stdin, so only the sampled stretches of the file are read. The runner probes each input first so the list follows the container's start time. Containers without a keyframe index, such as MPEG-TS, fall back to one keyframes-only window. The capability check runs a test list, so an ffmpeg that can't read one leaves movies on chapters instead of marking files unusable.
  • Rules: the last 900 s (or 25%) are sampled every 3 s. The episode keyframe rules apply with movie bounds: 15–900 s, and credits from visuals must end within 180 s of the end of the file. Silence refinement reads only about 12 s of audio around the chosen start.
  • Scheduling: the nightly run does movies after episodes under the same lock, with a 60-minute movie budget per run; a server without Chromaprint that runs its chapter pass without the lock leaves movies to the lock holder. A movie's tail is stored only once its credits are placed, so an interrupted run leaves the movie eligible. Lazy playback and /api/v2 refresh-markers accept movies; redetect-intro and the frozen /api/v1 endpoints stay episode-only. An online refresh that changes markers now notifies active playback even when no local analysis follows.
  • Library setting: the detection toggle now shows for movie libraries as "Detect credits markers (best effort)". It defaults to off for new movie libraries; existing libraries keep their stored value.

/api/v2 gains GET /api/v2/admin/markers/capabilities, an acting-admin capability document whose movie_credits field tells clients that refresh-markers accepts movies. Existing operation IDs and paths are unchanged; the OpenAPI document, web types, fixtures and the system-info fixture's contract digest were regenerated.

Validation

  • The committed rules reproduce the validated prototype on 58 of 58 movies' saved keyframe data, with both silence methods; the episode comparison still agrees on 99 of 99.
  • Samples mode on jellyfin-ffmpeg 7.1.4: frames land at the requested sample times, including a path containing a quote and a backslash.
  • Movie eligibility, budget, artifact skip, lazy and admin movie paths, and ffconcat escaping tests; web library form tests: pass. OpenAPI, web types and fixtures are current.
  • On a 40-movie test library the analysis wrote credits for 34 movies (14 from chapters, 20 from visuals); three files missing from disk were recorded as failed with backoff. A frame check of 18 visual results found 7 on target, 10 late (the credits had already started), and 1 early (below).
  • On a Linux test server with an Intel GPU, six 4K and 1080p movies were analyzed end to end. Movies with a credits chapter used it; a mislabelled "End Credits" chapter five minutes into a film was rejected; the visual results matched the prototype.

Risks

  • Known limitation: a film that ends with historical "what happened next" text cards on black before the real credits can have its credits start on the first card, so Skip Credits would skip the epilogue. Movies have no automatic next-episode countdown, so this only matters when the viewer presses the button.
  • Existing mixed libraries with marker detection on will start analyzing their movies.
  • silo-apple and silo-android keep copies of get_system_info_ok.json; their contract digest needs the same update when this merges.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code), using its Workflow tool to run subagents
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5[1m] (main session), claude-opus-5-5 (implementation and review subagents)
  • Involvement: Fully AI-generated, not yet human verified
  • Adversarial review: A separate Claude Code review agent (claude-opus-5-5) checked the ffconcat path on jellyfin-ffmpeg 7.1.4, sample-time mapping across containers and codecs, the movie candidate query, budget and backoff, lazy and admin paths, and re-ran the prototype comparison. It found a blocking issue (sample times followed the container's own timestamps, so MPEG-TS files decoded nothing) and a major one (the capability check did not cover the concat demuxer). Both are fixed and tested. The frozen /api/v1 endpoints were restored to episode-only.

🤖 Generated with Claude Code

Note

Add best-effort local movie end-credit detection with sampled tail analysis

  • Adds a Samples mode to mediasample that decodes only requested timestamps via an ffconcat list on stdin, with a keyframes-only window fallback for non-indexed containers, plus concat-demuxer capability probing in caps.go
  • Scheduled marker runs now analyze movies after episodes: pages of candidates get a one-hour movie budget, cached movie-tail artifacts with backoff, and per-item/per-file analysis entry points in analyzer_movie.go
  • Admin refresh and lazy playback paths accept movie items and analyze credits only; a new admin marker-capabilities endpoint advertises movie-credit support
  • New movie libraries default marker detection to off, with credits-only labeling in the library form
  • Behavioral Change: Analyzer.Run now runs both episode and movie passes; episode-only runs without the cluster lock happen when Chromaprint is unsupported; eligibility error/type names in repository.go were generalized from episodes to items

Macroscope summarized bf66650.

Quick104 and others added 6 commits September 26, 2026 22:29
…tive starts

The silencedetect parser now reads silence_start and silence_end events in
output order and pairs each end with the most recent open start, instead of
matching them by index. Values may be negative or use an exponent because
ffmpeg prints them with %.6g; a negative window-relative start is clamped to
the window start, and an end with no open start is ignored. A table test
covers these cases along with a trimmed jellyfin-ffmpeg 7.1.4 excerpt.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The intro fingerprint table now stores per-file media analysis artifacts of any kind, with a status (complete, unusable, failed), failure backoff, and the server that recorded a failure. The migration only adds columns and keeps the primary key, so binaries from before this change keep reading and upserting intro fingerprints during a rolling deploy. The repository gains generic load, upsert, and failure methods, and the intro fingerprint methods become thin wrappers over them. This gives later analysis kinds, such as credits fingerprints, a place to cache results and failures without new tables.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ing package

Intro detection built its own ffmpeg argv, parsed silencedetect output, decoded raw Chromaprint, and limited concurrency inside intromarkers. That code now lives in internal/mediasample behind a typed, JSON-serializable Request and a Runner that records runs under a new analysis process-metrics workload, so later detectors and remote nodes can share it. Capability checks are cached per ffmpeg binary identity and reset alongside the tonemap probe cache on re-probe. Fingerprint output and silence events are unchanged against jellyfin-ffmpeg 7.1.4.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Local marker analysis now finds TV episode credits. It reads authored credits
chapters first, copies them to other versions of the same episode, and
otherwise compares a cached Chromaprint fingerprint of each episode's tail
across the season, writing only strong matches that reach the end of the file.
Each marker kind is owned separately, so higher-priority credits are never
overwritten and an online intro no longer blocks local credits. Playback
analysis asks only for the kinds the file lacks and keeps a settled credits
season, so an episode without detectable credits does not repeat the season
comparison on every start.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…O priority

Scheduled and admin-triggered intro/outro analysis now starts its ffmpeg child at nice 19 in the idle I/O class on Linux, so fingerprinting and silence refinement only use CPU and disk time that playback leaves free. Analysis started from playback keeps normal priority. The child is forked from a dedicated locked thread whose priority is lowered and then discarded, with a handoff when that goroutine lands on the main thread so the server itself never stays lowered. If the priority cannot be lowered, one warning is logged and the run continues; other platforms are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… windows

The local marker analyzer now takes a marker kind and a fingerprint window instead of assuming an intro at the start of the file. A markerKind enum drives candidate ownership, effective sources, and MarkerPatch writes, and candidates carry the credits marker columns. Matching bounds, confidences, and the algorithm label move into a per-kind matchProfile, and segments are offset by the window start. Intro detection keeps the same results and stored keys, so credits detection can build on this without a behavior change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b55d6743-7076-4ae4-b527-274d41335031

📥 Commits

Reviewing files that changed from the base of the PR and between f3de8f4 and bf66650.

📒 Files selected for processing (61)
  • contracts/api/v2/fixtures/admin_marker_capabilities.json
  • contracts/api/v2/fixtures/admin_network_access_status_not_found.json
  • contracts/api/v2/fixtures/admin_network_access_unknown_host.json
  • contracts/api/v2/fixtures/admin_subtitle_metadata_precondition_required.json
  • contracts/api/v2/fixtures/get_system_info_ok.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/fixtures/list_series_seasons_invalid_artwork.json
  • contracts/api/v2/fixtures/login_provider_null.json
  • contracts/api/v2/fixtures/playback_installation_changed.json
  • contracts/api/v2/fixtures/playback_invalid_protocol.json
  • contracts/api/v2/fixtures/playback_progress_conflict.json
  • contracts/api/v2/fixtures/start_device_login_temporary_null.json
  • contracts/api/v2/fixtures/theme_songs_playback_not_acceptable.json
  • contracts/api/v2/fixtures/theme_songs_playback_unauthorized.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • docs/architecture/intro-detection.md
  • docs/architecture/media-sampling.md
  • docs/markers-api.md
  • internal/api/handlers/admin_intro.go
  • internal/api/handlers/admin_intro_test.go
  • internal/api/handlers/admin_marker_population.go
  • internal/api/handlers/playback_lazy_markers.go
  • internal/api/handlers/playback_lazy_markers_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_catalog_intro.go
  • internal/apiv2/admin_catalog_intro_test.go
  • internal/apiv2/document_test.go
  • internal/intromarkers/analyzer.go
  • internal/intromarkers/analyzer_credits.go
  • internal/intromarkers/analyzer_credits_tail.go
  • internal/intromarkers/analyzer_movie.go
  • internal/intromarkers/analyzer_movie_test.go
  • internal/intromarkers/analyzer_test.go
  • internal/intromarkers/credits_movie.go
  • internal/intromarkers/credits_movie_test.go
  • internal/intromarkers/repository.go
  • internal/intromarkers/repository_movie.go
  • internal/intromarkers/repository_movie_db_test.go
  • internal/intromarkers/types.go
  • internal/mediasample/args.go
  • internal/mediasample/args_test.go
  • internal/mediasample/caps.go
  • internal/mediasample/caps_test.go
  • internal/mediasample/concat.go
  • internal/mediasample/concat_test.go
  • internal/mediasample/ffmpeg_test.go
  • internal/mediasample/probe.go
  • internal/mediasample/request.go
  • internal/mediasample/request_test.go
  • internal/mediasample/run.go
  • internal/mediasample/run_test.go
  • internal/mediasample/stats.go
  • internal/taskmanager/tasks/detect_intro_markers.go
  • internal/taskmanager/tasks/detect_intro_markers_test.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts
  • web/src/components/admin/libraries/LibraryFormSections.tsx
  • web/src/components/admin/libraries/libraryTypes.ts
  • web/src/components/admin/libraries/useLibraryForm.save.test.tsx
  • web/src/components/admin/libraries/useLibraryForm.ts
 ______________________________________________________________________
< You used `any` like it's a life jacket. Spoiler: it's a pool noodle. >
 ----------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T19:03:20.632027Z bf66650 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@macroscopeapp

macroscopeapp Bot commented Sep 27, 2026

Copy link
Copy Markdown

The Validation tasks: line understates the Web case as merely related and omits the Apple and Android C1 cases. This PR adds movie credits to the server playback-marker data those clients consume, changing the marker fixtures and skip timing they exercise. Please use:

Validation tasks: changes #1148 C1; changes #1149 C1; changes Silo-Server/silo-apple#311 C1; changes Silo-Server/silo-apple#312 C1; changes Silo-Server/silo-android#321 C1; changes Silo-Server/silo-android#322 C1

These cases are all recorded as Not run, so there are no prior results to classify. No validation was performed.

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

Posted via Macroscope — v1 validation impact

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8c83bb941

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/apiv2/admin_catalog_intro.go Resolved

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AI-assisted review using OpenAI Codex.

Quick104 and others added 3 commits September 27, 2026 11:38
Episode credits now combine the season's ending-audio match with each file's end-credit visuals. One ffmpeg pass over the tail window samples keyframe blackness and signal statistics, silences, and the Chromaprint fingerprint, and the result is cached as a versioned credits_tail analysis artifact. Lone episodes and seasons without a shared ending theme can now get credits from visuals alone, while chapter credits still take precedence. Undecodable or unsuitable files are recorded as unusable; transient ffmpeg failures back off and are retried.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every API server runs the task manager, so each one started its own daily
marker detection pass and repeated the same ffmpeg work. The task now takes a
PostgreSQL advisory lock before analyzing; a server that finds it held records
a skipped run instead. Playback-time and per-item analysis are not affected.
Cluster lock release-failure logs now name the task they belong to.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Movies in movie and mixed libraries with marker detection on now get local credits markers, from a credits chapter or, failing that, from keyframes sampled every three seconds over the last 900 seconds with the movie limits. Sampling reads only the sampled stretches through an ffconcat list; the runner probes each input first so the list's inpoints follow the container's start time, and reads containers without a keyframe index, such as MPEG-TS, as one keyframes-only window instead. The capability check runs a test list, so an ffmpeg that cannot read one leaves movies on chapters instead of marking their files unusable. Lazy playback, the nightly run, and /api/v2 refresh accept movies; the frozen /api/v1 endpoints stay episode-only, and new movie libraries leave detection off.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104
Quick104 force-pushed the outro/c4-movie-credits branch from f8c83bb to bf5ce68 Compare September 27, 2026 15:42
@Quick104
Quick104 force-pushed the outro/l1-single-runner branch from 6ca1f0e to 4453665 Compare September 27, 2026 15:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf5ce68507

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Quick104

Copy link
Copy Markdown
Contributor Author

Updated the Validation tasks: line: movie credits reach the same playback marker data, so all six C1 tasks are now listed as changes.

Quick104 and others added 11 commits September 27, 2026 11:55
…ilure

RecordArtifactFailure locked the artifact row before deciding whether a
failure may replace it, but that lock covers nothing when the row does not
exist yet. Another server's first complete result, inserted in that gap, was
then overwritten by the failure upsert. Without a row, the failure is now
inserted only if the key is still free; if a row appeared meanwhile, it is
locked and judged again, so a settled result for the same file stands.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…a timer

assertWaiting treated a 20 ms timeout as proof that Acquire was blocked,
so a goroutine the scheduler had not yet run could pass as waiting. The
asynchronous limiter tests now run in a synctest bubble and call
synctest.Wait, which returns only once the Acquire goroutine is durably
blocked or done. acquireAsync closes its channel when Acquire fails, so
an error is not mistaken for waiting.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A tail ruled out by probe metadata (no video codec, or an all-intra
codec) was stored as an unusable credits_tail row keyed only by file
hash, size, and duration. A probe repair that later filled in or
corrected the codec left the row in force, so the file was never
sampled, even on a forced refresh. The write also ran before the ffmpeg
limiter, so a large season of such files issued one concurrent upsert
per file.

The check is now made from current metadata on every analysis and never
stored. A row an earlier build stored this way is treated as missing
when met. The credits season state's input signature covers the same
check, so a settled group is analyzed again after a repair.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A season group analyzed while ffmpeg lacked the tail-pass filters was
settled under the same analysis hash a tail-capable run uses. After an
ffmpeg upgrade, or on a capable server in a mixed cluster, the group was
skipped as settled and never got visual credits until its files changed
or an admin forced a refresh.

CreditsAnalysisConfigHash now covers the tail key only when the analysis
ran tail passes, so each mode keeps its own settled state.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e missing kind

With markers.online_storage set to on_demand, playback's marker updates reloaded the stored row before and after local analysis, so players lost the online intro or credits they had just been shown, and local analysis was asked for a kind the player already had. The playback handler now keeps the on-demand lookup and lays its online and plugin markers back over each reload with the new markers.OverlayOnline, which uses the same precedence as ApplyResult: manual markers still win, and a fresh lookup replaces an online marker left over from stored mode. Missing kinds are worked out from the file players see, so an online intro sends local analysis after credits only. Stored mode is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… black

The black-level comment said the percentile skips broken keyframes,
which holds only for tails of 200 or more keyframes. Shorter tails use
their darkest keyframe on purpose, as TestTailBlackLevel pins.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ing version

A credits chapter followed by its own chapter, such as a post-credits scene, now ends where that chapter starts even within 15 seconds of the end of the file; only the last chapter's end snaps to the end. Before, Skip Credits jumped over the authored scene. A version of an episode without chapters now copies chapter credits from the chapter-bearing version whose duration it matches, not from whichever was listed first, which rejected valid copies when an episode had several chapter-bearing versions.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
When a credits marker failed to write, the season group was still recorded as complete, so scheduled and playback analysis skipped it until its inputs changed and the missing marker was never retried. The group is now recorded as failed, which is not settled, so the next run analyzes it again. settleSeasonState keeps a failed status instead of turning it into partial, which would settle the group for a week.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Admin refresh started analyzing credits as well as intros for every caller, which changed the frozen /api/v1 refresh-markers and redetect-intro routes and the v2 redetect-intro port of them. Those now analyze episode intros only, as before credits existed. Only v2 refresh-markers, in local and both modes, runs intro and credits analysis. The analyzer gains AnalyzeEpisodeKinds so the handler chooses the kinds.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With credits season state keyed by tail mode, a server that cannot run
tail passes found no state of its own for a group a tail-capable server
had settled. It re-analyzed the group, and its credits-audio:v1 result
could replace the credits-audio:video:v1 marker, since both are one
scored family. The capable server's state still matched, so it never
restored the marker.

An unforced run without tail passes now also skips a group settled under
the tail-mode hash. A tail-capable run still checks only its own hash,
so groups settled audio-only are analyzed again once tail passes work.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Quick104 and others added 14 commits September 27, 2026 12:24
…m playback reloads

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…r lock

A server whose ffmpeg cannot fingerprint audio could win the marker
detection lock, run only its chapter pass, and make servers that can
compare season groups skip that run. The task now checks the analyzer's
Chromaprint preflight before claiming the lock and, when it fails, runs
the chapter-only pass without the lock.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ffmpeg fails the whole combined tail run when its audio output finds no
stream, so a file whose probe metadata named audio it cannot give had its
usable video tail stored as permanently unusable. The tail pass now runs
the video alone after a no_stream failure; when that succeeds the tail is
kept and the fingerprint is stored as having no audio. A pass that still
finds no stream lacks video, so the audio-only run decides the fingerprint
instead of assuming there is no audio.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Keep the intro-only v1 routes and v2 redetect-intro from below: the
handler picks the marker kinds per endpoint, and a request without
credits takes episodes only, so v2 redetect-intro rejects a movie as it
did before movies were analyzed. v2 refresh-markers still takes movies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…k and lookups

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Episodes no longer store a credits tail ruled out by probe metadata (no
video, or an all-intra codec), since a probe repair can change that
verdict without changing the file. Movies still stored it, and the
nightly candidate query treated any unusable row as settled, so a
repaired movie was never sampled. Movies now decide it on every analysis
before reading any artifact, never store it, and the candidate query
ignores such rows an earlier build stored. These movies are listed each
run, but their analysis reads no artifact and runs no ffmpeg.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
v2 redetect-intro analyzes episode intros only and rejects movies, so
the movie_credits capability field and the operation summaries now name
refresh-markers alone. A handler test pins the movie rejection.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	internal/intromarkers/analyzer.go
A server whose ffmpeg lacks Chromaprint runs the detect-markers task
without the cluster lock, so it never makes a capable server skip. Run
also does the movie pass, which needs no Chromaprint, so such a server
would analyze movies unlocked alongside the lock holder and repeat the
work the lock exists to keep on one server. The unlocked path now calls
RunEpisodes, which skips movies; the locked run still does both.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The marker detection task dropped the cluster lock on any Preflight
error, so a timed-out or failed ffmpeg capability listing let a server
run the full pass unlocked once Run's own probe succeeded. Require now
returns errors matching mediasample.ErrUnsupported, and the task skips
the lock only for that; any other preflight failure keeps the lock.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	docs/architecture/intro-detection.md
#	internal/taskmanager/tasks/detect_intro_markers.go
#	internal/taskmanager/tasks/detect_intro_markers_test.go
…orted

Require returned a plain error when ffmpeg cannot read a sampled input
list, so callers could not tell it from a failed capability listing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 363b21bec7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/intromarkers/analyzer_movie.go Resolved
Quick104 and others added 2 commits September 27, 2026 13:41
A server whose ffmpeg lacks Chromaprint ran only its chapter-only episode
pass, outside the cluster lock, and left movies to the lock holder. On a
single-node install there is no other holder, so no movie was ever
analyzed, not even from a credits chapter.

The task still runs that episode pass without the lock, then tries the
lock and, when it gets it, runs a movie-only pass (Analyzer.RunMovies) and
merges its summary into the task result. When another server holds the
lock, it skips the movies, which that server analyzes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The scheduled movie pass read every eligible movie file into memory in one
unbounded query before it started the 60-minute budget, so a large library
could spend unbounded time and memory before analysis began, outside the
budget.

The pass now lists 200 movies at a time with keyset pagination on the
query's existing order (retry flag, created_at, id), so a movie analyzed in
the run that is still eligible is not listed again. The budget starts
before the first query, and the pass lists no further page once it is
spent. The eligibility SQL is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19f48bf3d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…resh's local analysis

With online markers stored on demand, a refresh that ran local analysis
for one file of an item reloaded every file from storage before telling
active playback, so a file whose online markers came only from the
refresh lost them in that update. Keep each file's on-demand overlay
from the refresh and lay it over the reloaded row, as lazy playback
does. The on-demand setting check is now shared by both paths.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc06720da0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return nil
}
lock := t.lock
if err := t.analyzer.Preflight(ctx); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate the movie lock on movie-tail capability

In a heterogeneous cluster, this preflight checks only Chromaprint before one server claims the lock for both passes. A node can support Chromaprint but lack one of the movie-tail requirements checked by PreflightMovieTail (such as concat sampling or a stats filter); if that node acquires the lock, movieTailReady silently reduces its movie pass to chapters, while movie-capable nodes skip at the !acquired branch. Chapterless movies can therefore remain unanalyzed on every run depending on which node wins the lock. Include movie-tail capability when assigning responsibility for the movie pass, or allow an incapable lock holder to leave that pass for a capable node.

AGENTS.md reference: AGENTS.md:L13-L18

Useful? React with 👍 / 👎.

Base automatically changed from outro/l1-single-runner to main September 27, 2026 18:54
# Conflicts:
#	contracts/api/v2/fixtures/admin_network_access_status_not_found.json
#	contracts/api/v2/fixtures/admin_network_access_unknown_host.json
#	contracts/api/v2/fixtures/admin_subtitle_metadata_precondition_required.json
#	contracts/api/v2/fixtures/get_system_info_ok.json
#	contracts/api/v2/fixtures/list_series_seasons_invalid_artwork.json
#	contracts/api/v2/fixtures/login_provider_null.json
#	contracts/api/v2/fixtures/playback_installation_changed.json
#	contracts/api/v2/fixtures/playback_invalid_protocol.json
#	contracts/api/v2/fixtures/playback_progress_conflict.json
#	contracts/api/v2/fixtures/start_device_login_temporary_null.json
#	contracts/api/v2/fixtures/theme_songs_playback_not_acceptable.json
#	contracts/api/v2/fixtures/theme_songs_playback_unauthorized.json
#	docs/admin-catalog-api.md
#	docs/architecture/intro-detection.md
#	docs/architecture/media-sampling.md
#	docs/markers-api.md
#	internal/api/handlers/admin_intro.go
#	internal/api/handlers/admin_intro_test.go
#	internal/api/handlers/admin_marker_population.go
#	internal/api/handlers/playback_lazy_markers.go
#	internal/api/handlers/playback_lazy_markers_test.go
#	internal/intromarkers/analyzer.go
#	internal/intromarkers/analyzer_credits.go
#	internal/intromarkers/analyzer_credits_tail.go
#	internal/intromarkers/analyzer_test.go
#	internal/intromarkers/repository.go
#	internal/intromarkers/types.go
#	internal/mediasample/args.go
#	internal/mediasample/args_test.go
#	internal/mediasample/caps.go
#	internal/mediasample/caps_test.go
#	internal/mediasample/ffmpeg_test.go
#	internal/mediasample/request.go
#	internal/mediasample/request_test.go
#	internal/mediasample/run.go
#	internal/mediasample/run_test.go
#	internal/mediasample/stats.go
#	internal/taskmanager/tasks/detect_intro_markers.go
#	internal/taskmanager/tasks/detect_intro_markers_test.go
#	web/src/components/admin/libraries/LibraryFormSections.tsx
@Quick104
Quick104 merged commit 50729f0 into main Sep 27, 2026
9 of 17 checks passed
@kody-ai

kody-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

@Quick104
Quick104 deleted the outro/c4-movie-credits branch September 27, 2026 18:58
func (e *ChromaprintExtractor) PreflightMovieTail(ctx context.Context) error {
caps, err := mediasample.LoadCapabilities(ctx, e.config.FFmpegPath)
if err != nil {
return err

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Kody Rules medium

The error from mediasample.LoadCapabilities is returned bare, discarding call context and breaking the error chain. Wrap it with fmt.Errorf and the %w verb to preserve the origin of the failure for logs and debugging, matching the pattern used in SampleMovieTail and SampleMovieSilences; since candidate is not in scope in PreflightMovieTail, use a static message such as fmt.Errorf("loading ffmpeg capabilities: %w", err).

Kody rule violation: Wrap errors with context using fmt.Errorf with %w

return fmt.Errorf("loading ffmpeg capabilities for file %d: %w", candidate.FileID, err)

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

t.Fatalf("candidates with a metadata unusable row %v, want %v", got, want)
}
// An episode tail stored for a file does not count as its movie tail.
candidates, _ = repo.ListMovieCandidatesForFile(ctx, f.files["scannerCredits"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Kody Rules medium

The error from repo.ListMovieCandidatesForFile is discarded with _, so a failed lookup leaves candidates empty and the subsequent candidates[0] index fails for the wrong reason while hiding the real error. Capture the returned error and fail the test explicitly with t.Fatal before using the result.

Kody rule violation: Avoid ignoring errors from SDK/gRPC calls

candidates, err = repo.ListMovieCandidatesForFile(ctx, f.files["scannerCredits"])
	if err != nil {
		t.Fatal(err)
	}

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant