Skip to content

[codex] Mirror ABS playback into live sessions - #203

Merged
Quick104 merged 1 commit into
mainfrom
codex/abs-session-admin-activity
Jun 26, 2026
Merged

Quick104 merged 1 commit into
mainfrom
codex/abs-session-admin-activity

Conversation

@Quick104

@Quick104 Quick104 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Start a native Silo playback session when ABS clients call /api/items/{id}/play and reuse that native session ID as the ABS session ID.
  • Keep admin live-session state fresh from ABS heartbeats, session close, and public track transport activity.
  • Wire the native session manager/syncer into the ABS handler and add focused regression coverage.

Root Cause

ABS compatibility playback only persisted rows in abs_playback_sessions. The admin dashboard reads live playback from native sessions reconciled into playback_sessions_sync, so ABS playback could work while remaining invisible in admin Activity.

Scope

Part of the reported ABS compat admin Activity regression in this Codex thread. I checked for an existing matching GitHub issue and did not find one; the only search result was unrelated download-permission issue #141.

Validation

  • GOWORK=off go test ./internal/audiobooks/abs ./internal/audiobooks
  • GOWORK=off go test ./internal/audiobooks/... ./internal/worker
  • git diff --check

GOWORK=off go test ./cmd/silo is currently blocked in this worktree because web/embed.go requires web/dist, which is not present (pattern all:dist: no matching files found).

Risks / Follow-up

  • Should be verified against a real ABS mobile client after deploy to confirm the client sends heartbeat and close events as expected.

AI Use

Implemented with Codex.

Summary by CodeRabbit

  • New Features

    • Added support for native playback session syncing during audiobook playback, including start, progress updates, and session close handling.
    • Resume positions are now preserved more reliably when starting playback.
  • Bug Fixes

    • Improved handling of playback sessions so session state stays in sync across play, sync, and close actions.
    • Fixed cleanup so playback-related session state is stopped when a session ends.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af381ed3-b2f2-452e-b289-cf17d0f911dc

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb7a60 and b552a17.

📒 Files selected for processing (8)
  • cmd/silo/main.go
  • internal/audiobooks/abs/file_handler.go
  • internal/audiobooks/abs/handler.go
  • internal/audiobooks/abs/native_sessions.go
  • internal/audiobooks/abs/native_sessions_test.go
  • internal/audiobooks/abs/play_response.go
  • internal/audiobooks/abs/progress.go
  • internal/audiobooks/service.go

📝 Walkthrough

Walkthrough

ABS playback now creates and mirrors native playback sessions during play start, stores resume position in ABS session records, and updates native state on session sync, close, and track transport requests through the ABS handler wiring.

Changes

ABS native playback session mirroring

Layer / File(s) Summary
Session contracts and wiring
internal/audiobooks/abs/native_sessions.go, internal/audiobooks/abs/handler.go, internal/audiobooks/service.go, cmd/silo/main.go
PlaybackSessionManager and PlaybackSessionSyncer are added to the ABS dependency model, and the service/main wiring passes native session collaborators into the handler.
Play-start session setup
internal/audiobooks/abs/native_sessions.go, internal/audiobooks/abs/play_response.go, internal/audiobooks/abs/native_sessions_test.go
handlePlayStart resolves resume time before session creation, starts a native playback session, stores the current position in the ABS session row, and is covered by the new play-start test.
Transport begin and end
internal/audiobooks/abs/file_handler.go, internal/audiobooks/abs/native_sessions.go
handlePublicTrack brackets the request with native transport begin/end calls, and the helper methods wrap BeginTransport and EndTransport with missing-session handling.
Session progress and close mirroring
internal/audiobooks/abs/native_sessions.go, internal/audiobooks/abs/progress.go, internal/audiobooks/abs/native_sessions_test.go
handleSessionSync updates native playback progress, handleSessionClose stops native sessions, both paths trigger native-session sync, and tests cover the sync and close requests.

Sequence Diagram(s)

Play-start session creation

sequenceDiagram
  participant handlePlayStart
  participant startNativePlaybackSession
  participant PlaybackSessionManager
  participant PlaybackSessionStore
  participant PlaybackSessionSyncer
  handlePlayStart->>startNativePlaybackSession: create native session
  startNativePlaybackSession->>PlaybackSessionManager: StartSessionWithFilesContext(...)
  startNativePlaybackSession->>PlaybackSessionSyncer: SyncNow(ctx)
  handlePlayStart->>PlaybackSessionStore: insert ABSPlaybackSession
Loading

Session sync and close mirroring

sequenceDiagram
  participant handleSessionSync
  participant updateNativePlaybackProgress
  participant handleSessionClose
  participant stopNativePlaybackSession
  participant PlaybackSessionManager
  participant PlaybackSessionSyncer
  handleSessionSync->>updateNativePlaybackProgress: currentTime
  updateNativePlaybackProgress->>PlaybackSessionManager: UpdateProgress(...)
  updateNativePlaybackProgress->>PlaybackSessionSyncer: SyncNow(ctx)
  handleSessionClose->>stopNativePlaybackSession: stop session
  stopNativePlaybackSession->>PlaybackSessionManager: StopSession(...)
  stopNativePlaybackSession->>PlaybackSessionSyncer: SyncNow(ctx)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: mirroring ABS playback into live sessions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/abs-session-admin-activity

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 marked this pull request as ready for review June 25, 2026 18:51
@Quick104
Quick104 merged commit 6598aba into main Jun 26, 2026
1 check passed
@Quick104
Quick104 deleted the codex/abs-session-admin-activity branch June 26, 2026 16:27
Quick104 added a commit to RXWatcher/silo-server that referenced this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant