Skip to content

fix(playback): keep the keyframe playlist when a transcode moves nodes - #4050

Merged
Quick104 merged 1 commit into
mainfrom
fix/issue-4048-rehome-keyframe-playlist
Nov 13, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/issue-4048-rehome-keyframe-playlist

Conversation

@Quick104

@Quick104 Quick104 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4048
Related issue: N/A
Validation tasks: none

Other clients: N/A (no client-visible change)

When the API can no longer reach the transcode node behind a relayed stream, it moves the transcode to another node. With Complete playlists for copied video (playback.copy_keyframe_playlist) on, a copy session may already have given the player the planned VOD playlist. The start request for the new node left out keyframe_playlist, so that node ran with FFmpeg's own playlist. FFmpeg's segment boundaries don't match the planned ones, so after the move the player could jump, repeat, or lose A/V sync on a seek.

The move now sends the recipe's keyframe_playlist and refuses a node whose start response doesn't echo it, the same check a fresh start and the jellycompat start already run.

Approach

rehomeStartRequestV3 copies KeyframePlaylist from the recipe card like the other recipe fields, and the move's attestation list gains ValidateKeyframePlaylistAttestation. A refused node is stopped and skipped through the existing rollback, as for the other attestations. With that check in place, the move does what docs/transcode-node-api.md already says it does, so the docs need no change.

Jellycompat sessions don't go through this path; their move uses the node's recipe reconstruction, which already carries the field.

Validation

  • Added a handler test that moves a keyframe-playlist copy session to a node that doesn't echo the field. It fails on main (the move succeeds without sending the field) and passes here (the start carries keyframe_playlist and the node is refused).
  • go test for internal/api/handlers and internal/transcodenode: pass.
  • make lint-changed: no issues.
  • Not reproduced on a deployment: that needs remote transcode nodes and one going unreachable mid-stream. The defect is shown in the source and by the test above.

Evidence: https://evidence.siloserver.org/r/silo-server/issue-4048/

Risks

  • On current main the new node still serves FFmpeg's playlist if it hasn't read the file before. A fresh node start reads the keyframe index without waiting for its full check, so on first sight of a file it falls back. fix(playback): plan copy playlists from the Cues, without a full-file check #2515 removes that check and plans from the Cues at start, which closes this case. Until it merges, this change covers moves to a node that already has the file's index.
  • A node too old to echo keyframe_playlist is now refused for a move of a keyframe-playlist session, as it already is for a fresh start. If no remaining node qualifies, the move fails instead of continuing with a mismatched playlist.
  • The setting is experimental and off by default. Sessions without it are unchanged.

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 (in T3 Code)
  • Tool(s): Claude Code, Codex (cross-provider plan review)
  • Model(s): claude-opus-5-5 (implementation, plan review, code review), claude-sonnet-5-5 (code-review cleanup finder), gpt-6.1-sol (plan review)
  • Involvement: AI-assisted
  • Adversarial review: Before implementation, gpt-6.1-sol attacked the plan and claude-opus-5-5 cut it. The first plan also added a node-side reconstructed request flag so a new node would wait for the full keyframe check. That was dropped because fix(playback): plan copy playlists from the Cues, without a full-file check #2515 removes the check. Each review flagged the mixed-version and first-read cases now listed under Risks. A medium-level multi-agent code review of the final diff found no defects beyond those risks. A simplify pass made no changes. The background adversarial review (gpt-6.1-sol, reviewed a729136) found no defects beyond the limits listed under Risks.

🤖 Generated with Claude Code

Note

Fix keyframe playlist loss when a transcode moves nodes

The rehome handler PlaybackHandler.moveTranscodeToNodeV3 now copies the recipe card's KeyframePlaylist value into the remote playback start request, so the setting survives a node move. The candidate start is also rejected when its response fails keyframe-playlist attestation validation.

  • Adds a regression test in playback_transcode_rehome_test.go: a relay move with a keyframe-playlist recipe fails (non-200) when the candidate node does not attest it, and the node receives one start request with KeyframePlaylist set.

Macroscope summarized a729136.

When the API moved a transcode off a node it could no longer reach, the
start request for the new node left out keyframe_playlist, and the move
did not check the node's echo of it. A planned copy session then ran on
the new node with FFmpeg's playlist while the player held the planned
one. The move now sends the recipe's keyframe_playlist and refuses a
node that does not confirm it, as a fresh start does.

Closes #4048

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/S 0–49 added + deleted lines (all files); change volume, not priority. label Nov 13, 2026
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T02:27:29.242678Z a729136 PR opened
🔒 Security Review ✅ Completed 2026-11-13T02:29:19.962287Z a729136 PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Moved-transcode start requests now include the recipe’s keyframe-playlist setting. The start response validation checks the keyframe-playlist attestation. A test verifies that a candidate response without the attestation is refused.

Changes: Transcode rehome

Layer / File(s) Summary
Pass and validate keyframe playlist
internal/api/handlers/playback_transcode_rehome.go, internal/api/handlers/playback_transcode_rehome_test.go
The rehome start request copies the recipe’s keyframe-playlist setting, and response validation checks its attestation. The test verifies that a moved segment is not served when the candidate omits the attestation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Silo-Server/silo-server issue 4044 describes planned keyframe playlist loss on a seek restart. This change covers the transcode-move path, not the seek-restart path.

Suggested reviewers: rhainland, manava, blurbery

Merge Risk: Minimal · up to a7291

Moved transcodes now keep the recipe's keyframe playlist, and nodes that do not echo it are refused. Behavior for sessions without the setting is unchanged. No merge-blocking risk was identified.

Security architecture risk: Low · up to a7291

The change strengthens an existing failover check without showing an expansion of access or privileges. Older nodes may no longer qualify for affected moves, and cleanup remains best-effort when a node cannot be reached. Deployment behavior has not been confirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed decision is scoped to the existing playback session and transport moving among policy-selected executors. It does not itself authorize new destinations, media inputs, users or privileges. Existing API-egress and executor-eligibility restrictions remain ahead of candidate selection.

Trust Boundaries and Controls

  • observed — Node start and stop routes remain behind node-authentication middleware, and start retains input-path approval. The new playlist check is an additional acceptance condition, not a replacement for those authority controls.
  • observed — The echo indicates acceptance of the requested option, not proof of identical playlist contents. The node responds from session options, while existing keyframe planning can return no plan without clearing that option. This limitation predates the PR; previously, moved requests omitted the option altogether.

Resilience and Maintainability Implications

  • observed — Concurrent requests on one API process share a bounded move operation, independent of an individual request’s cancellation. Rollback sends a signed, cancellation-detached DELETE with a five-second timeout. Node stop serializes against start and reconstruction, but failed delivery is logged rather than preventing further candidate attempts; the existing idle reaper is a recovery mechanism, not confirmation of immediate teardown.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the move of a transcode to another node now keeps the keyframe playlist. The raw summary, the description, and the objectives all describe this same change in the reho…
Linked Issues check Passed Issue #4048 requires that a moved transcode keep the recipe's keyframe_playlist and that the new node's response be checked for the echo, as on a fresh start. The reviewed diff in internal/api/handler…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes two lines in playback_transcode_rehome.go and adds one test function. Each change serves issue #4048. The added attestation and the added request field…
Description check Passed The description states the problem (the move to another node omits keyframe_playlist when playback.copy_keyframe_playlist is on), the approach (copy KeyframePlaylist into rehomeStartRequestV3 and add …
Full details: Title check

Explanation

The title names the main change: the move of a transcode to another node now keeps the keyframe playlist. The raw summary, the description, and the objectives all describe this same change in the rehome start request and its attestation.

Full details: Linked Issues check

Explanation

Issue #4048 requires that a moved transcode keep the recipe's keyframe_playlist and that the new node's response be checked for the echo, as on a fresh start. The reviewed diff in internal/api/handlers/playback_transcode_rehome.go meets both parts. rehomeStartRequestV3 now sets KeyframePlaylist: card.KeyframePlaylist. moveTranscodeToNodeV3 now includes transcodenode.ValidateKeyframePlaylistAttestation in its attestation errors.Join, so a node that does not echo the field is refused through the existing rollback. The new test TestRelayMoveKeepsTheKeyframePlaylist in playback_transcode_rehome_test.go covers a move to a node that does not echo the field. It asserts the refusal and that the start request carried KeyframePlaylist. The test was not run in this review. The PR states that the test fails on main and passes at head. Residual limitation, acknowledged in the PR and not a coding gap in this change: a new node that has not yet read the file's keyframe index can still fall back to FFmpeg's playlist. The PR defers this to #2515.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes two lines in playback_transcode_rehome.go and adds one test function. Each change serves issue #4048. The added attestation and the added request field are the fix. The test is the required regression check. No unrelated files or hunks appear in the reviewed changes. The jellycompat path is not changed, which the PR explains and which the issue does not require.

Full details: Description check

Explanation

The description states the problem (the move to another node omits keyframe_playlist when playback.copy_keyframe_playlist is on), the approach (copy KeyframePlaylist into rehomeStartRequestV3 and add ValidateKeyframePlaylistAttestation to the move's attestation list), validation (a handler test, go test, make lint-changed), and risks. It directly matches the changeset described in the raw summary, so it is related and specific enough to pass.

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: ad947e45-7ab0-427a-92d3-226e971fb8fa
Commits

Reviewing files that changed from the base of the PR and between 0b3467a and a729136.

Files selected for processing: 2

  • internal/api/handlers/playback_transcode_rehome.go
  • internal/api/handlers/playback_transcode_rehome_test.go

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish labels Nov 13, 2026
VideoSampleEntry: card.VideoSampleEntry,
VideoRange: card.VideoRange,
CopyVideoMPEGTS: card.CopyVideoMPEGTS,
KeyframePlaylist: card.KeyframePlaylist,

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 Bug high

Moved starts can attest the flag while discarding the keyframe plan

On a cold destination cache, planCopySegments receives ErrUnverified, leaving the node serving FFmpeg's playlist while attesting the flag. Treat moved starts as reconstructions and use verified-index planning before accepting them.

Prompt for LLM
File internal/api/handlers/playback_transcode_rehome.go, line 596:

Moved starts can attest the flag while discarding the keyframe plan

A destination with a cold keyframe-index cache treats the move as a fresh start, so `planCopySegments` receives `ErrUnverified`, records an unplanned session, and the node still attests the flag despite serving FFmpeg's playlist. Mark moved starts as reconstructions and use the verified-index planning path before accepting the move so the player's existing planned playlist remains valid.

Talk to Kody by mentioning @kody

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

​

​

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.

Right, and it's on purpose. The PR's Risks section lists it. On main, a node's fresh start reads the keyframe index without waiting for the full check, so a node that has never read the file serves FFmpeg's playlist even when it echoes the flag.

I tried marking moved starts as reconstructions and dropped it for two reasons:

  • The full check (VerifyMatroska) reads every block header, close to reading the whole file. The move gives each node 35 s to start, and a cut-off check isn't cached, so on large files every candidate could time out and the move would fail outright.
  • fix(playback): plan copy playlists from the Cues, without a full-file check #2515 removes that check, LoadVerified, and opts.Reconstructed, and plans from the Cues at start. Once it lands, a node that has never read the file plans right away, and a reconstructed request field would have nothing left to switch on.

This PR fixes the dropped field and the missing echo check. The first-read case closes with #2515.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That makes sense. I withdraw the recommendation to mark moved starts as reconstructions: the verification cost and 35-second per-node timeout could turn the workaround into an availability problem, and #2515 is intended to remove the path it would rely on.

The remaining limitation is worth keeping explicit: echoing keyframe_playlist does not guarantee that a cold destination has produced the planned playlist. Until #2515 lands, this PR improves moves to nodes with an already-verified index but does not fully prevent the mismatch on cold nodes.

@Quick104
Quick104 merged commit ac54052 into main Nov 13, 2026
34 of 36 checks passed
@Quick104
Quick104 deleted the fix/issue-4048-rehome-keyframe-playlist branch November 13, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/S 0–49 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Moving a transcode to another node drops the keyframe playlist

1 participant