Skip to content

Support plan_invalidated_v1: server-initiated plan withdrawal (H.264 copy-safety race) #244

Open

Description

@Quick104

Context

The server is gaining an "optimistic remux race" for H.264 copy-safety (silo-server branches feat/persist-pps-copy-safety + feat/optimistic-remux-copy-safety, PRs to follow). When a file's multi-PPS verdict is unknown at plan time, the server no longer blocks playback start on the 1–5 s bitstream scan: it issues the remux plan optimistically, scans in the background, and if the file turns out copy-unsafe it withdraws the plan mid-session.

Nothing breaks if you do nothing. A client that has not implemented this feature has its session stopped by the server; the app's existing recovery mints a fresh attempt, which is planned against the now-persisted verdict and lands on a transcode. Implementing the feature upgrades that stop into a smooth in-place switch (same UX as a quality change).

What to implement

Full contract: docs/architecture/playback-protocol-v3.md §6.1 ("plan_invalidated_v1 — the server withdraws a plan") on the server branch. Web reference implementation: web/src/player/realtime-protocol.ts, web/src/player/hooks/usePlaybackSession.ts (invalidatePlan), web/src/player/components/VideoPlayer.tsx.

  1. Advertise the feature. Add "plan_invalidated_v1" to client_features on v3 start and replan requests — but only for video playback surfaces that can actually execute the command (the web client deliberately does not advertise it from the audiobook player).
  2. Declare the command. Include plan_invalidated in the supported-commands set sent in the realtime hello on the session control socket (GET /playback/sessions/{session_id}/control/ws).
  3. Handle the command. Envelope: name: "plan_invalidated", deadline_ms: 8000, payload: {"reason": "video_copy_unsafe", "plan_id": "<withdrawn plan>"}.
    • Ack accepted immediately.
    • If payload.plan_id is not the plan currently on screen, complete as a no-op — you already moved past the withdrawn plan; do not evict a route the server never complained about.
    • Otherwise run your ordinary recovery replan: operation: "failure_recovery" with the withdrawn plan's plan_attempt_key in attempted_plan_keys. Rebuild the player from the new plan and restore position (the replacement plan's timeline carries source_start_seconds).
    • Send result: completed once the replacement plan is adopted, rejected if it cannot be.
  4. Mind the deadline. The server stops the session unless a completed result arrives within deadline_ms — an ack alone does not stop the clock. A rejected result also stops the session (deliberately: the route genuinely desyncs decoders).

Notes

  • The command only ever fires for H.264 sources on a video stream-copy route whose verdict resolved unsafe after the plan was issued — first-ever play of a file, in practice. Inconclusive scans push nothing.
  • This is the first server-initiated control push in protocol v3; everything else remains client-pulled.

Related server issue: Silo-Server/silo-server#135. Filed on Quick's behalf via Claude Code.

Activity

  1. Quick104 commented on Aug 23, 2026

    @Quick104
    ContributorAuthor

    Server implementation is now up: Silo-Server/silo-server#734 (stacked on Silo-Server/silo-server#733). The protocol contract lives in docs/architecture/playback-protocol-v3.md §6.1 on that branch.

  2. added
    triaged
    and removed
    triaged
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions