Skip to content

fix(audiobooks): track Audiobookshelf plays that apps report only through local sessions - #4268

Merged
Quick104 merged 13 commits into
mainfrom
fix/issue-4244
Nov 15, 2026
Merged

Quick104 merged 13 commits into
mainfrom
fix/issue-4244

Conversation

@Quick104

@Quick104 Quick104 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4244
Related issue: #3108
Validation tasks: changes #1207 C1 (minor: Activity gains rows for reported Audiobookshelf plays, and their Terminate answers 404; native sessions and their controls are unchanged)

Other clients: N/A (no client change: reported plays reach the admin session list and Playback History that the web admin and the apps already read; Roku has no admin views)

Some Audiobookshelf apps never show up in admin Activity or Playback History. Plappa and Prologue on iOS never call /play. They stream the book's files directly and post their local session to /api/session/local or /api/session/local-all every few seconds. Silo saved the resume position from those posts and recorded nothing else.

A local session the client updated within the last minute is now tracked as a reported play: it shows in Activity while the reports keep coming, ends 90 seconds after the last one, and leaves a Playback History row with the book position and the listening time the client reported.

Approach

A reported play is stored only in Postgres, never in a server's memory. It has an abs_playback_sessions row, keyed by the client's own session id in a new client_session_id column, and a lifecycle start with frontend abs. Because no server holds it:

  • every API server applies the client's reports to the same play, so there are no per-server copies;
  • it never counts toward stream or transcode limits, since the app may be playing a downloaded copy;
  • no media route can load it. Native stream, subtitle, manifest, segment and replan routes need an in-memory session, a signed stream token or a playback attempt, and a reported play has none. The one route that loads by an ABS session id, the public track route, answers 404 for a reported play, and so do /session/{id}/sync and /close.

A report that continues a play whose start is recorded is one UPDATE. A report for a client session with no open play takes a per-account advisory lock, looks for the play again, and then admits a new one. So concurrent first reports on two servers start one play, and the 10-play account cap holds across the cluster. While a play has no lifecycle row (a server died between the row and the start), each report records the start again. A silent row whose start was never recorded gives up its cap slot at the next admission.

The admin session list now also shows open reported plays, read from their start row at the row's position, the same way it lists a native session that no server holds. The lifecycle sweep ends a reported play once no report has arrived for 90 seconds. It closes the row only while no later report has landed, using the database clock, so a report that arrives just after the sweep looked keeps the play going. The history row records the row's position and the listening credited since the row began. A report after the end starts a new play with a new id and its own history row, because lifecycle ids never start again.

A report the client updated longer ago than a minute is offline listening synced late. It only moves the resume position, as before. Reported plays now also count in the ABS listening stats and listening-session list, which matches how real Audiobookshelf keeps synced local sessions.

Validation

  • Live, on an isolated dev deployment built from the base (7fc39fbd): live local-session reports moved the resume position, while admin sessions and Playback History stayed empty.

  • Live, on the same deployment rebuilt from the head (4455093d):

    • Activity listed the play with the client name and the book's length, and the public track answered 404 for its id.
    • The sweep ended it about 100 s after the last report, with a history row showing position 365 s, 65 s listened (the client's total) and end reason expired.
    • A later report on the same client session started a new play with a new id that credited only the new listening.
  • Handler test: a live report starts one play and announces it once, a late sync starts none, and the play's id gets 404 on the public track, /sync and /close. With the public-track check removed, it fails. More handler tests check that a /session/local-all batch names its client from the envelope's deviceInfo, that a malformed optional field (deviceInfo, updatedAt) doesn't reject a sync, and that one request tracks at most ten live sessions. Each fails without its fix.

  • Postgres tests:

    • concurrent first reports start one play;
    • listening counts from the play's starting total and never goes negative;
    • an older report that arrives late keeps the newer position;
    • the cap, including a stale unannounced row giving up its slot;
    • a new play after an end;
    • listing, ending after silence, and a late report keeping a play alive.

    Both are added to scripts/ci/db-contracts.txt.

  • make lint-changed, go vet ./..., gofmt, go mod tidy -diff, make migrate-validate, make verify-local-paths, make lint-router-recovery, make verify-route-inventory: pass. go test ./... passes except two real-FFmpeg tests (TestRunStatsWithRealFFmpeg, TestCopyRemuxSubtitleRenditionRealFFmpeg) that fail the same way on main on this host. The web gate wasn't run: web/ is unchanged.

Evidence

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

Risks

  • Two migrations: three columns on abs_playback_sessions, and a partial unique index built CONCURRENTLY in its own migration.
  • Admin Stop and Terminate answer 404 for a reported play. No server holds one, and Silo isn't serving its media, so there is nothing to revoke. The app keeps playing either way, and the play ends when its reports stop.
  • The household sessions view reads only the live-session table, so a reported play shows in admin Activity but not there.
  • The live window trusts the device clock. A device more than a minute behind, or more than 30 seconds ahead, is never tracked.
  • An app that pauses for more than 90 seconds ends the play, and resuming starts a new one.
  • Audiobooks and Audiobookshelf compatibility are beta for 1.0.

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; GitHub CLI; Codex (plan review)

  • Model(s): claude-opus-5-5 (implementation, code review); gpt-6.1-sol (plan review)

  • Involvement: Fully AI-generated, human verified

  • Adversarial review: The plan was reviewed before implementation by gpt-6.1-sol, as an attack, and claude-opus-5-5, as a cut. That round added re-recording a missed start, a cap that counts every open reported play, a listening base taken from the first report, a live window shorter than the idle window, and 404 on /sync and /close. It also reused the sweep's existing end path. A three-finder code review at high effort, on claude-opus-5-5, led to:

    • a one-statement hot path;
    • freeing stale unannounced slots;
    • clamping negative listening;
    • the row's start time for a late start;
    • a database-clock close claim.

    A simplify pass ran on the change. A background adversarial review by gpt-6.1-sol (reviewed 4455093) found one issue: a /session/local-all batch named its client only on the envelope, so its plays showed as Audiobookshelf. Fixed in b40f883. Kody's reports are fixed too: a late report rewinding the position (5efeaaf), and a malformed optional field rejecting a sync (b871e82). Codex's security review led to a bound on how many live sessions one request tracks (c5753e6, refined in 337ed5e). Three reviewers' ordering findings led to a high-water client total that decides whether a report moves the position, and CodeRabbit's to a 30-second limit on future clock skew (c08d0d2).

🤖 Generated with Claude Code

Note

Track Audiobookshelf plays reported only through local sessions

Some Audiobookshelf apps report playback only via /session/local reports, never through a /play session. This PR tracks those plays as persisted "reported" plays without creating in-memory sessions.

  • Adds live-report handling in native_sessions.go: reports within a 1-minute window (plus 30s clock skew) create or update a reported play and announce a detached lifecycle start. Stale or over-budget reports never fail the sync response.
  • Stores reported plays via new UpdateReportedPlay and StartReportedPlay methods in abs_playback_session_store.go, with a 10-open-play per-account cap, advisory-lock serialization, and cleanup of stale unannounced rows. A migration adds the needed columns and a unique partial index.
  • Extends the lifecycle sweep in playback_lifecycle_sweep.go to close reported plays silent beyond a 90-second grace and record history from the reported row's facts.
  • Reported-only sessions return 404 on the public track, session-sync, and session-close endpoints.
  • Risk: ABSPlaybackSessionStore interface gains required methods, so external implementations must be updated. The lifecycle sweep now also selects and closes reported-play candidates — see loadLifecycleCandidates and endReportedPlay.

Macroscope summarized d3a3a5f.

Quick104 and others added 3 commits November 15, 2026 02:17
…ough local sessions

Plappa and Prologue on iOS never call /play. They stream the book's files
directly and post their local session to /session/local every few seconds,
so Silo kept the resume position but showed nothing in admin Activity or
Playback History.

A live local-session report (client updatedAt within a minute) now records
a reported play: an abs_playback_sessions row keyed by the client's session
id, plus a lifecycle start with frontend abs. No server holds it in memory,
so every API server applies reports to the same play, it stays outside
stream limits, and no media route can load it; the public track route and
the /play sync and close routes answer 404 for its id. A per-account
advisory lock finds or admits the play, so concurrent first reports start
one play and the ten-play account cap holds across the cluster. A report
records the lifecycle start again while the play has none.

Activity lists an open reported play from its start row at the row's
position. The lifecycle sweep ends it 90 seconds after its last report:
closing the row is the claim, so a report that lands after the sweep looked
keeps the play going. History takes the row's position and the listening
the client reported since the row began. A report after the end starts a
new play with its own id and history row.

Closes #4244

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stale slots

Review fixes for reported Audiobookshelf plays:

- A report that continues a play whose start is recorded is one UPDATE,
  with no transaction and no file lookup; the locked admission runs only
  when the client session has no open play.
- Admission closes the account's silent rows whose lifecycle start was
  never recorded, so they stop holding cap slots for a day.
- Listening is clamped at zero before the integer cast, so a nonsensical
  client total cannot fail every report.
- A start recorded late takes the row's start time.
- The sweep's close claim compares report times with the database clock.
- A refusal at the cap logs at debug level; it repeats every few seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: a905feeb-575e-4340-905c-a6cc49f81d8e
Commits

Reviewing files that changed from the base of the PR and between df87ddd and d3a3a5f.

Files selected for processing: 8

  • internal/api/handlers/playback_lifecycle_db_test.go
  • internal/api/handlers/playback_lifecycle_sweep.go
  • internal/audiobooks/abs/native_sessions.go
  • internal/audiobooks/abs/session_local.go
  • internal/audiobooks/abs/session_local_test.go
  • internal/audiobooks/abs_playback_session_store.go
  • internal/audiobooks/abs_playback_session_store_db_test.go
  • migrations/sql/20261115015846_abs_reported_plays.sql
Walkthrough

Audiobookshelf local-session reports now create durable reported plays. The changes add report identity and storage, detached lifecycle announcements, activity listing, and sweep-based expiry with history recording.

Changes: Audiobookshelf Reported Play Lifecycle

Layer / File(s) Summary
Reported-play storage and identity
internal/audiobooks/abs/progress.go, internal/audiobooks/abs_playback_session_store.go, migrations/sql/*abs_reported_plays*.sql, internal/audiobooks/abs_playback_session_store_db_test.go
Reported plays now have client-session identity and a listening baseline. Store operations update or create open rows under an account lock and enforce the open-play cap. A unique partial index covers open reported rows. Database tests cover concurrent reports, updates, limits, and re-creation after closure.
Local-session reporting and announcement
internal/audiobooks/abs/session_local.go, internal/audiobooks/abs/native_sessions.go, internal/playback/session.go, internal/audiobooks/abs/progress.go, internal/audiobooks/abs/file_handler.go, internal/audiobooks/abs/*_test.go
Live local-session reports update or start report-only plays and announce detached lifecycle starts. Report-only sessions return 404 through track, sync, and close paths. Tests cover repeated and late reports, device metadata, and malformed optional fields.
Lifecycle sweep and activity listing
internal/api/handlers/playback_lifecycle_sweep.go, internal/api/handlers/playback_sessions.go, internal/api/handlers/playback_lifecycle_db_test.go, docs/architecture/playback-lifecycle.md, scripts/ci/db-contracts.txt
Open reported plays appear in the activity listing at their reported position. The sweep conditionally ends plays after 90 seconds without a report and records expired history using reported playback totals. Database tests and lifecycle documentation cover listing and expiry.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant AudiobookshelfClient
  participant session_local
  participant trackReportedPlay
  participant ABSPlaybackSessionStore
  participant SessionManager
  AudiobookshelfClient->>session_local: Submit local-session report
  session_local->>trackReportedPlay: Track live report
  trackReportedPlay->>ABSPlaybackSessionStore: Update or start reported play
  ABSPlaybackSessionStore-->>trackReportedPlay: Return play state
  trackReportedPlay->>SessionManager: Announce detached start
Loading

Suggested reviewers: pukabyte, brady3035, rhainland

Merge Risk: Low · previous review df87d

Live Audiobookshelf reports now create trackable plays. Two narrow edge cases remain: a delayed report can rewind the resume position, and a client with a clock running ahead can cause a duplicate play and history row. Neither blocks the main flow; fix them before or shortly after merge.

Security architecture risk: Low · up to df87d

Reported plays remain account-scoped, with coordinated admission and explicit playback restrictions on updated servers. The main concern is deployment and rollback: older servers can interpret surviving reported-play IDs as playable session IDs unless those rows are isolated or drained.

Retained concerns

  • Medium · security · inferred: Report-only isolation is not backward-compatible for surviving rows. During mixed-version operation or rollback, an older server reads a new reported-play row as an ordinary ABS session and can serve its public track to someone who knows its ID, provided the row remains open, fresh and catalog-accessible. The head adds the necessary rejection, but the downgrade migration only drops the discriminator columns. Deployment or rollback controls that prevent this reader/writer combination were not established.
Security review details

Security Blast Radius

  • inferred — The conditional older-reader exposure concerns individual open reported plays, not unrestricted catalog access. Serving still requires the generated session ID, a fresh unclosed row and media accessible to its recorded principal. Local-sync replies return success or client-session results, not the generated playback ID.

Security Findings and Attack Paths

  • inferred — A holder of a reported-play ID could present it to an older server’s unauthenticated public-track endpoint. That reader ignores the new discriminator and can serve the book without the normal play-admission path. This becomes newly possible because reports now create compatible durable session rows; actual mixed-version reachability was not established.

Trust Boundaries and Controls

  • observed — On the reviewed head, reported-play ownership comes from the authenticated context rather than payload identity. Store updates include both user and profile, and report-only media and control requests receive the existing not-found response.

Resilience and Maintainability Implications

  • observed — Repeated detached starts are suppressed by the lifecycle session key. Silent rows with no lifecycle start are reclaimed during admission. Closing the ABS row and recording its end are separate steps, but an open lifecycle remains sweepable after closure, and lifecycle stop plus history persistence share a transaction.

Hardening Proposals

  • proposed — Use an explicit version-transition protocol: prevent reported-row creation until all serving readers understand report-only isolation, and quiesce creation and close surviving reported rows before routing traffic to older binaries or dropping the discriminator.
Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #4244 (direct) has coding requirements. The change set addresses most of them from the summary: (1) a reported play gets an abs_playback_sessions row and a lifecycle start, with frontend abs… Confirm, by reading the native stream, subtitle, manifest, segment, and replan route handlers, that each loads sessions only from the in-memory manager or a signed token or playback attempt, so a reported-play ID cannot reach media serving.…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: Audiobookshelf plays that apps report only through local sessions are now tracked. The changeset adds reported-play tracking, persistence, a lifecycle sweep, and 404 g…
Out of Scope Changes check Passed The changes trace to #4244 or to fixes for review findings on this PR. Lifecycle sweep, session listing, the migrations, the store methods, and AnnounceDetachedStart implement the reported-play path…
Description check Passed The description is specific and on-topic. It explains that some Audiobookshelf apps (Plappa, Prologue) post local-session reports without calling /play, so Silo never recorded their plays. It then des…
Full details: Title check

Explanation

The title names the main change: Audiobookshelf plays that apps report only through local sessions are now tracked. The changeset adds reported-play tracking, persistence, a lifecycle sweep, and 404 gates, all matching the title. The title follows the conventional commit format and is specific enough for a teammate scanning history.

Full details: Out of Scope Changes check

Explanation

The changes trace to #4244 or to fixes for review findings on this PR. Lifecycle sweep, session listing, the migrations, the store methods, and AnnounceDetachedStart implement the reported-play path. The public-track ReportOnly gate and the /sync and /close 404 implement the required route behavior. The deviceInfo batch fallback and the tolerance of malformed deviceInfo and updatedAt fields fix the review findings the PR lists. The PR also includes reported plays in ABS listening stats and the listening-session list. The issue does not request this. The PR states it as intended, so it is a disclosed consequence of recording these plays as playback sessions, not unrelated work. Reviewers may still want to confirm that scope. Lifecycle documentation and the db-contracts entries support the same behavior.

Full details: Description check

Explanation

The description is specific and on-topic. It explains that some Audiobookshelf apps (Plappa, Prologue) post local-session reports without calling /play, so Silo never recorded their plays. It then describes the fix: reported plays tracked in Postgres, a 90-second sweep expiry, 404 behavior for media routes, the 10-play cap, and the migrations. It also lists validation steps and risks. It clearly relates to the changeset, so it passes.

Full details: Linked Issues check

Explanation

Issue #4244 (direct) has coding requirements. The change set addresses most of them from the summary: (1) a reported play gets an abs_playback_sessions row and a lifecycle start, with frontend abs; (2) the sweep ends a play after 90 seconds of silence, and a later report starts a new play with a new ID and its own history row; (3) one play per client session across servers, through a unique open-play index and a per-account advisory lock; (4) the account cap of 10 is enforced in the same transaction; (5) reported plays do not enter the in-memory session manager, so they do not count toward stream or transcode limits; (6) the public track, /sync, and /close return 404 for a reported-play ID, with handler tests. The issue also requires that stream, subtitle, transcode manifest and segment, and replan routes answer not-found for these plays, enforced where sessions load for serving, with a test. The PR argues this follows from the absence of an in-memory session. The listed tests cover only the public track, /sync, and /close. No test or inspected code path shows the media routes returning not-found for a reported-play ID. Limits: this assessment used the summary and did not read the media route handlers.

Resolution

Confirm, by reading the native stream, subtitle, manifest, segment, and replan route handlers, that each loads sessions only from the in-memory manager or a signed token or playback attempt, so a reported-play ID cannot reach media serving. Add a test that requests each of these routes with a reported-play ID and asserts 404. Without that evidence, the media-route requirement remains unverified.

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

@silo-triage silo-triage Bot added the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Nov 15, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T03:27:00.408014Z d3a3a5f New commits
🔒 Security Review ✅ Completed 2026-11-15T03:29:55.971436Z d3a3a5f New commits

Security findings

Advisory findings (1)

ℹ️ 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 15, 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 ❌

@silo-triage silo-triage Bot added bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: compat Breaks a supported client or server path priority: P2 Limited scope, workaround exists, or polish labels Nov 15, 2026
@silo-triage

silo-triage Bot commented Nov 15, 2026

Copy link
Copy Markdown

Please add before-and-after captures of Activity and Playback History with the same test data at both desktop and phone widths, labeled with their builds. The current captures show the desktop after state only; the before API results do not show the before screen state, and the PR does not establish that mobile web is unaffected.

…report arrives late

A report delayed past a newer one rewound the play's position, which
Activity and the history row would show until the next report. The
client's listening total only rises within its session, so a report whose
total is behind the play's keeps the play alive but leaves the newer
position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 15, 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 left a comment

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.

Adversarial review (gpt-6.1-sol, reviewed 4455093)

F1 (P3) identifies lost client metadata in /session/local-all reported plays.

Validation: all 691 Goose migrations applied to a disposable Postgres database; the focused ABS, lifecycle, and session compatibility tests passed. A probe with 32 concurrent admissions of distinct client sessions kept ten open reported plays. The batch metadata reproduction used the mounted ABS handler and the Postgres playback-session store.

AI disclosure: Codex in T3 Code, model gpt-6.1-sol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

…n/local-all

Audiobookshelf clients send deviceInfo once on the local-all envelope, not
on each session, so a reported play from a batch showed as Audiobookshelf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

…ad of rejecting the sync

A deviceInfo name that is not a string, or an updatedAt that is not a
number, made the whole /session/local-all batch (or the single
/session/local session) fail to decode, so the client's progress never
synced. Those fields are optional: a malformed one now reads as unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

…lags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 15, 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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df87dddf17

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: df87dddf17

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…racks

A /session/local-all batch could ask for reported-play tracking on every
entry. A client has one live session at a time, so a request now tracks at
most the account cap's worth of live sessions, and none after the cap
refuses a play.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

…ses a new one

A refused start no longer stops the rest of the request: plays the client
already has open still take their reports, and only new starts stop. A
client session repeated within one request is tracked once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

@silo-triage silo-triage Bot added size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. and removed size/XL 500–999 added + deleted lines (all files); change volume, not priority. labels Nov 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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: 5e194744-f690-4abe-8e39-b45cfeff03be
Commits

Reviewing files that changed from the base of the PR and between 229a719 and df87ddd.

Files selected for processing: 16

  • docs/architecture/playback-lifecycle.md
  • internal/api/handlers/playback_lifecycle_db_test.go
  • internal/api/handlers/playback_lifecycle_sweep.go
  • internal/api/handlers/playback_sessions.go
  • internal/audiobooks/abs/file_handler.go
  • internal/audiobooks/abs/file_handler_public_track_test.go
  • internal/audiobooks/abs/native_sessions.go
  • internal/audiobooks/abs/progress.go
  • internal/audiobooks/abs/session_local.go
  • internal/audiobooks/abs/session_local_test.go
  • internal/audiobooks/abs_playback_session_store.go
  • internal/audiobooks/abs_playback_session_store_db_test.go
  • internal/playback/session.go
  • migrations/sql/20261115015846_abs_reported_plays.sql
  • migrations/sql/20261115015848_abs_reported_plays_open_index.sql
  • scripts/ci/db-contracts.txt

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 337ed5ee56

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…tal, and bound future clock skew

The position check compared a report against the floored, age-capped
listening credit, so a late report whose total rounded to the same second,
or one under the cap, could still rewind the position. The row now keeps
the highest client total it saw and moves the position only for a report at
or above it.

A report dated in the future by the device clock counted as live for up to
a minute, so a late copy of a play's last report could start the play again
after the sweep ended it. Future skew is now limited to 30 seconds, which
keeps it and the one-minute past window inside the 90-second idle window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

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

The end took the start position as the final position less the listening,
which is wrong after a seek. The lifecycle start row holds the position the
play began at; the history row now takes it from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 15, 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 00e5afe into main Nov 15, 2026
22 checks passed
@Quick104
Quick104 deleted the fix/issue-4244 branch November 15, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: compat Breaks a supported client or server path priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track Audiobookshelf plays that apps report only through local sessions

1 participant