Repository navigation
Description
Summary
docs/architecture/playback-protocol-v3.md states it is sufficient on its own:
A third-party client should be able to implement playback against a Silo server from this document plus the schemas, without reading any client repository and without reading the server source.
It documents four endpoints (capability, start, replan, route-events). A client that implements exactly those, and nothing else, will have its playback session garbage-collected roughly 45 seconds into playback. Nothing in the document, the JSON Schemas, or the conformance corpus says otherwise.
This is a documentation gap, not a protocol defect — the liveness mechanism itself is fine. But it is invisible, timing-dependent, and presents to the implementer as a server bug, so it is worth closing before the contract is treated as public.
Found while reviewing #567 for long-term third-party viability. Line references below are against that PR's head (codex/playback-v3-neutral-server).
Detail
Sessions are retired by SessionManager.CleanStale(), driven from the reconciler PreSync hook (cmd/silo/main.go:1755) on a 15s tick (internal/worker/reconciler.go:96):
internal/playback/session.go:228—DefaultActiveSessionGrace = 45 * time.Secondinternal/playback/session.go:236—DefaultPausedSessionGrace = 30 * time.Minute
Only three things refresh LastActivityAt:
POST /api/v1/playback/{session_id}/progress— not in the v3 spec- Transcode manifest/segment fetches —
internal/api/handlers/playback.go:1293,1311,1347,1370 - The control WebSocket —
internal/api/handlers/session_ws.go:139,152,168— not in the v3 spec
/stream/{session_id} does not touch activity, but BeginTransport/EndTransport (internal/api/handlers/stream.go:147,157) hold a transport count that exempts the session from cleanup for the duration of the request.
Two things that surprised me, both verified by reading the handler bodies:
POST /playback/replandoes not refresh session activity.POST /playback/route-eventsdoes not refresh session activity.
So the two mutation endpoints the spec does document contribute nothing to keeping the session alive.
There is a second-order effect on the paused grace. IsPaused is only ever written by SessionManager.UpdateProgress (internal/playback/session.go:695), reachable solely through the undocumented /progress endpoint. A client that never calls it is permanently IsPaused == false and is therefore always measured against the 45s active grace, never the 30-minute paused one — so it cannot earn the longer window even in the state that window exists for.
Observed failure shapes
For a hypothetical third-party client implementing only the documented surface:
| Delivery | Behaviour |
|---|---|
server_transcode_hls |
Survives. Segment fetches refresh activity as a side effect. |
original_http / server_remux_progressive |
Survives only while a request is in flight. A paused player with no open request dies ~45s later. |
server_remux_hls |
Same as above; the client re-requests the playlist, but that path does not touch activity. |
| Any, after session death | Next replan returns 404 playback_session_not_found, which the spec tells clients to treat as terminal and tear down. |
First-party clients are unaffected because they all post progress — the web player does so every 10s (web/src/player/hooks/useWatchProgress.ts:7) against a 45s grace. That 4.5× margin is exactly the kind of convention a third party has no way to discover.
Proposed fix
Documentation only; no behaviour change proposed here.
- Add a §2.5 Session liveness to
docs/architecture/playback-protocol-v3.mdcovering: the requirement to heartbeat, the 45s active / 30min paused grace and that they are server-configurable, which calls refresh activity, thatreplanandroute-eventsdo not, and thatIsPausedis only settable via/progress. - Document the three endpoints a working client needs that the spec currently omits:
POST /api/v1/playback/{session_id}/progressDELETE /api/v1/playback/{session_id}GET /api/v1/playback/sessions/{session_id}/control/ws(and whether it is an alternative to polling or purely additive)
- State a recommended heartbeat interval. 10s matches the shipping web client and leaves ample margin.
- Note that
stream.urlis opaque but that fetching it is not by itself sufficient to keep a session alive.
Worth deciding separately
Whether replan and route-events should refresh activity. Arguments both ways — route events are explicitly "diagnostics, not control" (§1), so having them extend a session lifetime muddies that invariant; but a client actively recovering from a failure is self-evidently alive, and having a replan succeed while the session it targets is being reaped is an unpleasant race. I lean toward replan refreshing activity and route-events not, but that is a behaviour change and belongs in its own PR with its own reasoning.
Scope
Part of #135. Relevant to #431, which asks for exactly this contract to be stable enough for a third-party client (Bloom) to build against.
AI Disclosure
- Tool(s): Claude Code
- Model(s): claude-opus-5
- Involvement: AI-assisted. Findings verified by reading handler bodies and session-manager source at
codex/playback-v3-neutral-server; no runtime reproduction was performed, and the failure-shape table is derived from code paths rather than observed on a deployment.
Activity
Tobechukwu-Njoku commentedon Oct 5, 2026
I'm working on this: a session liveness section in
playback-protocol-v3.mdsaying which calls keep a session alive, the 45-second grace while playing and 30 minutes while paused, and how a client ends a session. It will describe current behaviour and point to #666, which may tighten what counts. PR to follow.