Skip to content

refactor(playback): classify planner refusals beside the planner - #3946

Merged
Quick104 merged 2 commits into
mainfrom
refactor/playback-refusal-contract
Nov 11, 2026
Merged

Quick104 merged 2 commits into
mainfrom
refactor/playback-refusal-contract

Conversation

@Quick104

@Quick104 Quick104 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #3407
Validation tasks: none. #1177 C3 (worker failover) replans through this code, with no intended change.

When the planner refuses a file, the start and replan handlers decide what to try next: another version of the item, the same file without its subtitle, or a retry when settings or tone-map capabilities failed to load. They decided that from the planner's strings. Two reasons were declared a second time as literals in the handler, and one case searched the refusal's message for "this HDR source" and "4K transcoding is disabled". Rewording a planner message, or changing which reason a cause reports, could stop a fallback from running without any test or type noticing.

This change moves those answers next to the code that produces the refusals. It is the first of three stacked pull requests for #3407.

Approach

  • PlannerResultV3 answers the handlers' questions itself, in internal/playback/plan_refusal_v3.go: AnotherVersionMayPlay, SubtitleRefusal and ToneMapDependentRefusal. The handlers call these in place of their own reason lists.
  • The planner sets SettingsDependentRefusal on the four refusals a playback setting decides. The handler reads that field where it matched message text.
  • no_alternate_version and subtitle_conversion_unsupported are declared once in internal/playback and shared with the watch-together source fallback.

No reason, message or status a client receives changes. PlannerResultV3 is in memory only, so the new field touches no stored format. The classification is the same as before, including one quirk the new comment now states: every subtitle_conversion_unsupported refusal counts as tone-map dependent, whether or not a tone-map recipe was involved.

Validation

  • Go gate (go build, go vet, gofmt, make lint-changed): pass on this branch.
  • Playback, handler, watch-together and v2 API package tests: pass, except two FFmpeg-dependent playback tests that also fail on main on the machine used (its FFmpeg has no subtitles filter).
  • make verify-playback-fixtures: no diff.
  • The full Go and generated-contract gate ran at the top of the stack (see the third pull request). The web gate was not run; no web file changes.
  • As part of the stack, 4,392 start and replan requests were replayed against the merge base and against the stack's tip on two sandboxes with worker nodes. The decisions were identical.

Tests: the handler's test of the moved classification moved to the playback package with it, the settings-retry test now covers the marker, and two existing planner tables assert which refusals carry it.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3946/

No user-visible change.

Risks

A refusal classified differently would change which fallback the handlers try. The set of reasons and the four marked refusals were checked against every producer of those reasons in the planner; none is classified differently.

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 says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-fable-5-2, with claude-opus-5-5 subagents
  • Involvement: Fully AI-generated at the maintainer's direction; the maintainer has not yet reviewed the diff
  • Adversarial review: one independent read-only review of all three pull requests in this stack by a claude-opus-5-5 subagent. It found no defects and six comment or doc inaccuracies, all corrected before opening. A simplify pass ran on each commit.

🤖 Generated with Claude Code

Note

Move planner refusal classification from playback handlers to PlannerResultV3

  • Moves alternate-file, subtitle-refusal, and tone-map refusal classification from handler-local helpers (terminalAllowsAlternateFileV3, subtitleRefusalV3) to PlannerResultV3.AnotherVersionMayPlay, SubtitleRefusal, and ToneMapDependentRefusal in plan_refusal_v3.go
  • Adds SettingsDependentRefusal to PlannerResultV3. HDR/tone-map and 4K-setting refusals are marked via settingsRefusalV3, and retryIncompletePlaybackSettingsV3 converts marked refusals into retryable planning failures when settings could not be loaded. Unmarked refusals stay unchanged.
  • Adds exported terminal reason constants TerminalNoAlternateVersionV3 and TerminalSubtitleConversionUnsupportedV3 in protocol_v3.go; replaces string literals in the watchtogether fallback reasons.
  • Behavioral Change: playback-setting refusals (HDR, 4K, subtitle-forced) become retryable transcode-start failures when settings lookup fails; refusals not decided by settings, including the transcode-disabled subtitle case, remain terminal.

Macroscope summarized 39e90da.

The start and replan handlers decide what to try after a planner refusal:
another version, the same file without its subtitle, or a retry when
settings or tone-map capabilities failed to load. They decided it from
the planner's strings. Two reasons were re-declared as literals in the
handler, and the settings case matched message text.

The answers now live in internal/playback next to the code that produces
the refusals, as AnotherVersionMayPlay, SubtitleRefusal and
ToneMapDependentRefusal on PlannerResultV3. The planner marks the four
refusals a setting decides with SettingsDependentRefusal, which replaces
the message matching. no_alternate_version and
subtitle_conversion_unsupported are declared once and shared with the
watch-together source fallback.

No change in planner output or in what a client receives.

Part of #3407.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: c97abd91-e1c2-4cfa-94bc-981cd423bf20
Commits

Reviewing files that changed from the base of the PR and between 0e95e55 and 39e90da.

Files selected for processing: 11

  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_test.go
  • internal/api/handlers/playback_v3_union_test.go
  • internal/playback/fixed_source_v3_test.go
  • internal/playback/plan_refusal_v3.go
  • internal/playback/plan_refusal_v3_test.go
  • internal/playback/plan_v3.go
  • internal/playback/protocol_v3.go
  • internal/playback/protocol_v3_test.go
  • internal/playback/subtitle_policy_v3.go
  • internal/watchtogether/source_fallback.go
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 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-11T19:06:03.624224Z 39e90da New commits
🔒 Security Review ✅ Completed 2026-11-11T19:08:28.081118Z 39e90da 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.

@silo-kody

silo-kody Bot commented Nov 11, 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 ❌

@Quick104
Quick104 merged commit 1908856 into main Nov 11, 2026
17 checks passed
@Quick104
Quick104 deleted the refactor/playback-refusal-contract branch November 11, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant