Repository navigation
fix(playback): keep the keyframe playlist when a transcode moves nodes - #4050
Conversation
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 Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| VideoSampleEntry: card.VideoSampleEntry, | ||
| VideoRange: card.VideoRange, | ||
| CopyVideoMPEGTS: card.CopyVideoMPEGTS, | ||
| KeyframePlaylist: card.KeyframePlaylist, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, andopts.Reconstructed, and plans from the Cues at start. Once it lands, a node that has never read the file plans right away, and areconstructedrequest 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.
There was a problem hiding this comment.
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.
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 outkeyframe_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_playlistand refuses a node whose start response doesn't echo it, the same check a fresh start and the jellycompat start already run.Approach
rehomeStartRequestV3copiesKeyframePlaylistfrom the recipe card like the other recipe fields, and the move's attestation list gainsValidateKeyframePlaylistAttestation. A refused node is stopped and skipped through the existing rollback, as for the other attestations. With that check in place, the move does whatdocs/transcode-node-api.mdalready 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
keyframe_playlistand the node is refused).go testforinternal/api/handlersandinternal/transcodenode: pass.make lint-changed: no issues.Evidence: https://evidence.siloserver.org/r/silo-server/issue-4048/
Risks
keyframe_playlistis 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.Checklist
AI Disclosure
reconstructedrequest 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.moveTranscodeToNodeV3now copies the recipe card'sKeyframePlaylistvalue 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.KeyframePlaylistset.Macroscope summarized a729136.