Skip to content

feat(web): let a browser ask who's watching at launch - #2023

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:feat/web-profile-launch-picker
Oct 8, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:feat/web-profile-launch-picker

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1179
Validation tasks: none

The web app always reopens the last profile used in a browser. Silo 1.0's multi-profile criterion (#1179 AC2) requires every client to let the user choose between remembering the last profile and asking who is watching at launch, and the Apple apps already offer it. On a shared computer there was no way to make the web app ask, so a child could open a new tab straight into the parent's profile.

Approach

Settings > Your Devices gets a "This browser" group with a Profile at launch option: Remember last profile (the default, unchanged) or Ask who's watching. It is stored in this browser only, because it has to be read before any profile is chosen.

With Ask who's watching, each new tab or window starts at "Who's watching?" and a PIN-protected profile needs its PIN again, which matches AC3 for a device that does not remember the profile. Each tab keeps its own profile choice in sessionStorage, so opening a tab does not change the profile of tabs already open. Reloading a tab keeps its profile. Signing out, a refused session or a change of account clears the choice in every tab. Switching back to Remember last profile keeps the current tab's profile as the remembered one. "Duplicate tab" copies the tab's session, so a duplicated tab keeps its profile.

Validation

  • Built on 7d4b8318e. main at ca4f71b6e does not compile (internal/catalog/catalog_resolver.go:2172), so CI on this PR will fail on that file until main is fixed.
  • Web lint, format, build and bundle budget: pass. make test-web passes.
  • New tests cover both modes, two tabs with separate session storage, sign-out across tabs and switching modes; with the per-tab routing disabled they fail.
  • Checked in a browser against a running server: a new tab in ask mode opened at the picker with the deep link kept as its redirect, the first tab kept its profile, and a PIN profile needed its PIN in the new tab.

Evidence

Settings > Your Devices:

Before After
before-devices after-devices

A new tab opened on a title link while signed in as the PIN-protected Parent profile. Before, the setting does not exist and the tab opens the last profile without asking; after, with Ask who's watching selected, the tab starts at the picker:

Before After
before-launch-newtab after-launch-newtab

Recording (after, 28 s): select Ask who's watching in Settings > Your Devices, open a title in a new tab, pick the PIN-protected Parent profile, enter its PIN, and the tab continues to the title:

2023-after-ask-newtab-pin.mp4

Phone width (390×844). Settings > Your Devices, and a new tab opened on a title link (after: with Ask who's watching selected; before: the setting does not exist, so the tab opens the last profile):

Before After
before-devices-phone after-devices-phone
before-launch-newtab-phone after-launch-newtab-phone

Surface and build: web app. Desktop (1280×800): Devices before 7d4b8318e (main), new tab before 74158b4a8 (main), after d7da42342, recording on d7da42342. Phone (390×844, mobile emulation): before 74158b4a8 (main), after d7da42342. Captured with headless Chromium against a test server with synthetic media; artwork is blurred.

Risks

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (running in T3 Code)
  • Tool(s): Claude Code, GitHub CLI, Playwright (evidence capture)
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: An independent Claude Code review agent (claude-opus-5-5) checked that remember mode is unchanged, that no code reads the profile from storage around the new routing, the sign-out and impersonation clearing, and redirects after picking. It found no defects. An earlier version cleared the shared profile in every open tab; that was changed to per-tab selection before review.

Note

Add browser-local "ask which profile at launch" setting with per-tab profile isolation

  • Adds a settings group on the device settings page where the browser can choose to remember a profile or ask at each launch. The choice persists in browser storage via new utilities in profileLaunch.ts.
  • In ask mode, each tab gets its own tab-scoped profile selection in sessionStorage (storage.ts). Tabs keep isolated selections and separate epoch markers; switching back to remember adopts the current tab's selection into shared storage.
  • On sign-in, account restore, and sign-out, AuthProvider ends the profile epoch: it clears shared profile values and marks tab-scoped selections from the prior epoch as stale (useAuth.tsx).
  • usePostSignInNavigation and the sole-profile bootstrap now skip auto-selection when an ask-mode launch is pending, sending the user to the profile picker instead (usePostSignInNavigation.ts).
  • Includes full test coverage for launch restoration, tab isolation, epoch invalidation, and sole-profile behavior.
  • Behavioral Change: profile identifier, token, and serialized-profile reads/writes in storage.get/set/remove now route through tab-scoped storage when the tab's scope is active; other keys are unchanged. First profile access in a tab fixes that tab's scope based on the launch mode at that time.

Macroscope summarized d7da423.

Silo 1.0 requires every client to let the user choose between remembering
the last profile and asking who is watching at launch; the web app could
only remember. Settings > Your Devices now has a per-browser Profile at
launch option. With Ask who's watching, each new tab or window starts at the
profile picker and a PIN-protected profile needs its PIN again, while open
tabs keep their own profile. Remember last profile stays the default and
behaves as before.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 989d8e0e-ccc9-4e4a-b488-f1e39074d189
📥 Commits

Reviewing files that changed from the base of the PR and between 4bed990 and d7da423.

📒 Files selected for processing (10)
  • web/src/components/settings/ProfileLaunchSettingsGroup.test.tsx
  • web/src/components/settings/ProfileLaunchSettingsGroup.tsx
  • web/src/hooks/AuthProvider.profileLaunch.test.tsx
  • web/src/hooks/useAuth.tsx
  • web/src/hooks/usePostSignInNavigation.test.tsx
  • web/src/hooks/usePostSignInNavigation.ts
  • web/src/lib/profileLaunch.ts
  • web/src/pages/SettingsLayout.tsx
  • web/src/pages/settings/DeviceSettings.tsx
  • web/src/utils/storage.ts
  • Autopilot · 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-kody

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

Copy link
Copy Markdown

The new-tab launch behavior lacks comparative evidence: after-launch-newtab shows only the picker, not the remembered-profile launch it replaces or the PIN re-prompt. Please add before-and-after captures of the same launch state and a short recording of the Ask setting → new tab → PIN-protected profile flow.

Suggested fix: Add those captures and the recording to the Evidence section; no code diff applies.

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

Posted via Macroscope — Visible change evidence

@macroscopeapp

macroscopeapp Bot commented Oct 6, 2026

Copy link
Copy Markdown

The linked validation task tables currently show only Not run results; specifically, Web #1181 C2 is not marked failed or blocked. This PR therefore does not invalidate a recorded result or unblock a recorded blocker. Please update the line to Validation tasks: none; #1181 C2 can still receive its initial manual validation after the implementation is available.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Comment thread web/src/utils/storage.ts Resolved

Quick104 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Evidence: FAIL (desktop-only web)

Devices setting and launch picker Before|After at 1280×800 are present, but this web UI is also visible at phone width with no phone-width capture (and no mobile-unaffected note).

Fix: add phone-width captures of the Devices setting and/or ask-at-launch picker, or state that mobile is unaffected.

Grok commenting on Quick's behalf.

@Rhainland

Copy link
Copy Markdown
Contributor Author

The current Evidence section includes desktop and phone new-tab comparisons and a recording of selecting Ask who’s watching, opening a new tab, selecting the PIN-protected profile, and entering its PIN. Validation tasks is already none; the listed tasks still need their initial validation. The duplicate-tab finding was withdrawn in its thread and is now resolved.

@Quick104 Quick104 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.

Review at d7da42342. Two findings below need a product decision, and one is a low-severity edge case. The main gap, restored and reopened tabs, is posted as a reply in the existing duplicate-tab thread on storage.ts, because it answers the argument made there. I'm not pushing changes for any of these. Each one has more than one reasonable fix, so the choice is yours. The summary comment has the scores and the remaining checks.

Claude (claude-opus-5-5) commenting on Quick's behalf.

Comment thread web/src/utils/storage.ts

type ProfileScope = "shared" | "tab";

function profileScope(): ProfileScope {

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.

Low: a tab's scope doesn't follow a later switch back to Remember.

Trigger: the browser is in Ask mode, and tab A was opened after that, so its scope is tab. In tab B, the user switches to Remember last profile. adoptTabProfileSelection only moves tab B. Tab A keeps silo-profile-scope=tab in sessionStorage until it is closed, reloads included.

Impact: while tab A stays open, a profile picked there is not remembered for new tabs. isProfileLaunchPending() also stays true in tab A, so after a sign-in there, an account with one unlocked profile still lands on the picker, even though the setting says Remember. The settings page in tab A shows Remember as selected, so nothing tells the user why the tab behaves differently.

Repair options: (a) in profileScope(), treat a stored tab as stale when the launch setting is no longer ask, and move the tab to shared (adopting its selection, or dropping it so the remembered profile applies); or (b) keep it as it is, and say in the helper text that the change applies to tabs opened afterwards, as it already does for Ask. Option (a) changes which profile new tabs open if tab A's selection is adopted, so dropping it may be the safer variant.

const [mode, setMode] = useState<ProfileLaunchMode>(getProfileLaunchMode);
const labelId = useId();

function choose(next: ProfileLaunchMode) {

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.

Needs your call: any profile can turn Ask off, including a child profile.

/settings/devices has no profile gate, so a child profile on a shared computer can open Settings > Your Devices and switch the browser back to Remember last profile. Nothing is unlocked by itself: the adoption copies the child's own selection, and switching to the parent still needs the PIN. But the next time the parent unlocks their profile in that browser, it's remembered again, and new tabs open it without the PIN until someone notices the setting changed.

#2019 just limited household powers to the primary profile, so this may be worth matching: only the primary profile (or a PIN-verified selection) can switch from Ask to Remember, while switching to Ask stays open to everyone. Leaving it open is also defensible, since it's one browser's preference and not an account setting. If you keep it open, it would help to say so in the user manual issue (Silo-Server/siloserver.org#114).

@Quick104

Quick104 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: d7da42342. It merges cleanly with current main, including the newer DeviceSettings.tsx from #2019 and the device-selection change.

Fit: 9/10 · Readiness: 6/10 (conditional)

Fit. This closes the web gap in the 1.0 multi-profile criterion (#1179 AC2: every client lets the user choose between remembering a profile and asking who's watching). The setting is browser-local, which is the only place it can live: it has to be read before any profile exists, and the server's device settings are per profile. It sits in Settings > Your Devices under a clear "This browser" label. Remember stays the default, so nothing changes for people who never open the setting.

Readiness. Remember mode is unchanged. endProfileEpoch() only adds an epoch write next to the clearProfile() calls that already removed the same keys, and it doesn't run on a normal load or reload. Required checks pass. What holds the score at 6 is one open decision:

  • Needs your call (medium): in Ask mode, a tab that is reopened (Ctrl/Cmd+Shift+T) or restored by the browser comes back on its old profile and PIN proof without asking, because browsers keep sessionStorage for those tabs and profile proofs don't expire. This is separate from the duplicate-tab case already settled above: the original tab is gone. Options are in the thread reply: narrow the helper text, or keep the PIN proof out of sessionStorage in Ask mode.
  • Needs your call (low): any profile, including a child profile, can switch the browser back to Remember. See the review comment on ProfileLaunchSettingsGroup.tsx.
  • Low: a tab opened under Ask keeps its own per-tab scope after the browser is switched back to Remember from another tab. See the review comment on storage.ts:107.

I made no commits. Each item above has more than one reasonable fix.

Considered and left out: a sign-out or sign-in in another tab leaves a live tab's React profile and in-memory proof in place until it reloads. Remember mode already behaves that way, so this PR doesn't introduce it. Also left out: a fallback for browsers where sessionStorage throws but localStorage works. That's rare, and I found no concrete browser that does it.

Validated features. No passed case is affected. The cases this diff could reach (admin impersonation #1200 C1–C2, invitation sign-up #1197 C2, branding #1229 C1, calendar #1136 C3, person browsing #1144 C5) take the same Remember-mode path as before. Validation tasks: none is correct. The web multi-profile cases (#1181 C1–C4) have not been run yet; when they are, run them once in Ask mode too.

Earlier feedback. The phone-width evidence and the recording that Macroscope and the earlier evidence comment asked for are now in the PR body, and the published evidence page is linked from the Evidence check.

User manual. Silo-Server/siloserver.org#114 covers the new option. If the restore behaviour stays as it is, that issue should say a reopened or restored tab keeps its profile.

Apple and Android. Web-only change. Apple already offers the option, per the PR body. Android tracks it in Silo-Server/silo-android#473 and #499, with Silo-Server/silo-android#498 open for TV.

Method. A multi-agent code review at high effort (three finders and a validation-impact check), plus one cross-provider round with Codex (gpt-6.1-sol) that reproduced the restore case against a mounted AuthProvider in JSDOM. I didn't build a sandbox or run a real browser restart for this review.

Claude (claude-opus-5-5) commenting on Quick's behalf.

@Quick104
Quick104 merged commit d81d00f into Silo-Server:main Oct 8, 2026
33 checks passed
Quick104 added a commit that referenced this pull request Oct 8, 2026
Main's eager launch bundle is 322026 B brotli, 42 B past the budget's 1024 B tolerance, so Web (build) fails on main and every pull request. Most of the growth since the budget was last set comes from #2023: the per-tab profile choice and "Who's watching?" check run during sign-in on every launch, so they can't be loaded lazily. Moving its settings-only helpers into their own module made the bundle 199 B larger, so this records the current size instead.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants