Skip to content

fix(playback): record the viewer's address in admin playback history - #2967

Merged
Quick104 merged 2 commits into
mainfrom
fix/admin-history-client-ip
Oct 24, 2026
Merged

Quick104 merged 2 commits into
mainfrom
fix/admin-history-client-ip

Conversation

@Quick104

@Quick104 Quick104 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

When a playback attempt ends, its admin playback history row stores the address of the request that ended it, not the viewer's address. If an administrator stops or terminates a stream, the row holds the administrator's address. If the session expires, the row holds no address. This change stores the viewer's address in both cases.

Nothing reads the column yet, so no one sees the wrong value today. A future history field or monitoring integration that shows it would surface the wrong address for every row written before the fix, so rows should be correct from now on.

Approach

The history entry now takes the address from the playback session. The session records the viewer's address when playback starts and updates it on each v3 route description. A session rebuilt from its recipe card, after a restart or on another replica, now takes the address from the media request that rebuilds it; before, it had none. Before, the entry read the address from whatever ended the session: the administrator's request for a stop or terminate, and a request-less background context for an expiry. The history upsert keeps the first client_ip it writes, and every path that ends a session now writes the same viewer address.

docs/admin-api.md now says what the stored address is, and that rows written by earlier server versions hold the address of the request that ended the attempt. Existing rows are left as they are.

Server only. No API response includes the column, so clients and jellycompat need no follow-up.

Validation

  • Not reproduced on a live server, because no route exposes the column. The proof is the source path above plus the new unit test.
  • The test covers an administrator terminate, whose request carries a different address, and an expiry with no request address. On the base commit both cases fail the way the bug predicts: the first records the administrator's address, the second records none. Both pass on this branch.
  • TestReconstructSessionRestoresClientMetadata now checks that a rebuilt session carries the rebuilding request's address. It fails on the base, where the address is empty, and passes on this branch.
  • Go gate passes: embed stub, build, gofmt, vet, make lint-changed, make lint-router-recovery, make verify-local-paths, and make test-go against a freshly migrated database. After the reconstruction fix: build, vet, make lint-changed, and the playback and handlers packages pass.
  • Web gate not run: no web files changed.

Evidence

One admin-visible change: a session rebuilt after a server restart, or on another replica, now shows the viewer's address in Admin Activity and the account's "Watching now" card. Before, those showed no address until the session's next replan. The history fix itself changes nothing anyone sees, since no route reads that column. The evidence page holds the test output and the gate results; it has no captures of a restart mid-stream yet.

Evidence: https://evidence.siloserver.org/r/silo-server/admin-history-client-ip/

Risks

None identified. Rows written before this change keep the ending request's address, as the docs note.

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 subagents
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated. claude-opus-5-5 wrote the code, the test, the docs change, and this description.
  • Adversarial review: The plan review round was skipped because this is a mechanical one-field change. A background review with Codex (gpt-6.1-sol) of 1c28c28 found one issue: sessions rebuilt from their recipe card had no address. Fixed in dad1129.

🤖 Generated with Claude Code

Note

Fix admin playback history to record the viewer's address

  • api.PlaybackHandler.buildAdminHistoryEntry now uses the client address stored on the playback session instead of the address from the request that finalizes the session, in playback.go
  • playback.TranscodeManager.reconstructSession now populates the reconstructed session's client address from the request context, so rebuilt sessions retain the address
  • Documents the new semantics in admin-api.md, including legacy-row behavior: administrator termination stores the admin's address and expiry stores none
  • Behavioral Change: history entries now show the viewer's last address, not the finalizing request's address

Macroscope summarized dad1129.

The admin history row took its client address from the request that
finalized the session. An administrator's stop or terminate recorded the
administrator's address, and an expiry recorded none. Use the address the
playback session already tracks for the viewer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/S 0–49 added + deleted lines (all files); change volume, not priority. label Oct 23, 2026
@silo-kody

silo-kody Bot commented Oct 23, 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 commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T02:26:34.419074Z dad1129 New commits
🔒 Security Review ✅ Completed 2026-10-23T02:27:37.179645Z dad1129 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.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent 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: 92b67796-f44b-407d-927b-437fe8dd5b6c
📥 Commits

Reviewing files that changed from the base of the PR and between 31fabc7 and dad1129.

📒 Files selected for processing: 5
  • docs/admin-api.md
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_test.go
  • internal/playback/recipecard_test.go
  • internal/playback/transcode_manager.go

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

📝 Walkthrough

Reconstructed playback sessions now take the viewer’s address from the request context. Admin playback history entries use the session’s address. The documentation describes current and legacy address values.

Changes: Playback history client IP

Layer / File(s) Summary
Set address on reconstructed sessions
internal/playback/transcode_manager.go, internal/playback/recipecard_test.go
Reconstructed sessions now take ClientIP from the request context. The reconstruction test verifies the address.
Use session address in admin history
internal/api/handlers/playback.go, internal/api/handlers/playback_test.go, docs/admin-api.md
Admin history entries now use session.ClientIP. A test covers administrator termination and expiry contexts. The documentation describes the address stored by current and earlier server versions; the documented 503 and masked 500 responses remain.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: rhainland

Merge Risk: ⚪ Minimal · up to dad11

The playback history attribution change is ready to merge; no actionable current-head risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: recording the viewer's address in admin playback history.
Description check Passed The description directly explains the address-recording bug, the implementation, reconstruction behavior, documentation changes, and validation results.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 23, 2026

@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 1c28c28)

One verified finding: reconstructed playback sessions lose the viewer address in history. The focused history-entry and session-reconstruction tests pass, but do not cover this lifecycle.

AI disclosure: Reviewed by Codex gpt-6.1-sol in T3 Code.

Comment thread internal/api/handlers/playback.go Resolved
A session rebuilt from its recipe card after a restart, or on another
replica, had no client address, so a viewer stop before any replan
recorded none in admin playback history. Take it from the media request
that rebuilds the session, which comes from the viewer's player.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added size/M 50–199 added + deleted lines (all files); change volume, not priority. and removed size/S 0–49 added + deleted lines (all files); change volume, not priority. labels Oct 23, 2026
@silo-kody

silo-kody Bot commented Oct 23, 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 ❌

@macroscopeapp

macroscopeapp Bot commented Oct 23, 2026

Copy link
Copy Markdown

Reconstructed sessions now populate client_ip, which appears in the admin live-session response and is rendered in Admin Activity and account “Watching now”; the PR describes the linked page as test/gate results, not captures of this visible effect. Please add before-and-after captures of the same reconstructed session in the affected admin view at desktop and mobile widths, with matching API response excerpts if available.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant