Skip to content

fix(home): reload Home when the app returns after a load was cut off - #752

Merged
Quick104 merged 2 commits into
mainfrom
fix/home-reload-after-suspension
Oct 13, 2026
Merged

Quick104 merged 2 commits into
mainfrom
fix/home-reload-after-suspension

Conversation

@Quick104

@Quick104 Quick104 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

On iPhone, Home can come back from the background showing the full-screen "Can't reach the server" error even though the server is fine. It happens when a Home load starts as the app goes to the background and is cut off by suspension, or fails while a push wakes the app in the background. Home stays on screen while the app is away and only loads when it appears, so nothing loads it again. The error stays until the person taps Try Again. It showed up on a real iPhone while testing push notifications: tapping a notification brought the app back to this error, and Try Again loaded Home immediately.

This change hides failures that happen in the background, and makes Home reload when the app returns.

Approach

  • HomeView passes the scene phase to HomeViewModel. A Home load that fails while the app is in the background keeps the loading placeholder instead of setting the error, and skips its quick retry. Home then loads again when the app becomes active, so the error never flashes.
  • A load that ended in an error while the app was open is also retried when the app returns. A Home that loaded fine is left alone.
  • A load still running when the app goes to the background may have had its request cut off, so on return Home starts a fresh load and drops the old request. Each load is numbered, and a replaced load's late failure or rows are ignored. The quick retry re-checks after its delay whether the app has left; if so, it waits for the return instead of sending a request.
  • The diagnostics breadcrumb still records the background failure, since that record is how this bug was found.
  • Home's view and view model are shared by iPhone, iPad, Mac and Apple TV. iPhone, iPad and Mac gain the reload on return. Apple TV already reloaded on return through its own refresh, and now also skips showing a background failure.

Validation

  • iOS simulator: 50 passed, 0 failed across HomeSectionsMutationTests (three new tests), PersonalStateSyncTests, ApplePushNotificationSyncTests and ApplePushRegistrationTests. Each new test fails with its part of the fix undone. The cut-off-load test fails on the previous head: two fetches instead of three, and the error shown.
  • Signed iOS Debug build: passed. Silo, SiloTV and SiloMac Debug builds: passed.
  • Reproduced on iPhone, iPad and Apple TV simulators. A local proxy held Home's first load, the app went to the background, and the proxy dropped the request so it failed in the background, then answered normally again.
    • iPhone and iPad: on main, Home came back showing the error and made no new request. With this change it reloaded by itself.
    • Apple TV: on main, the error showed for about a second before the existing return refresh replaced it. With this change no error frame appears.
  • Not captured:
    • A failure that arrives after the return; only the new test covers it.
    • A long real suspension on a device.
    • Mac, because screen capture over SSH is refused on the build Mac, and running a Debug build there would change its signed-in Silo app.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-apple/pr-752/

Surface and build: Home on iPhone and iPad (iOS 27.0 simulators) and Apple TV (tvOS 27.0 simulator), with before and after captures and recordings. Builds: main (860bb6f) before and this branch (740ea14) after. Mac was not captured; the evidence page explains why.

Risks

  • While the app is in the background, a Home load that fails keeps the placeholder rather than showing the error. That only changes what the person sees on return: Home reloads then, and shows the error only if that load fails too.

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 (in T3 Code), with T3 Code delegated agents
  • Tool(s): Claude Code; Codex for the read-only adversarial review
  • Model(s): claude-opus-5-5 (implementation), gpt-6.1-sol (adversarial review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Read-only Codex review (gpt-6.1-sol, xhigh reasoning) of 31b73d3 found one issue: a load that crossed into the background and failed after the return still left the error up, and the quick retry didn't re-check the background state. Fixed in 740ea14 with a test that fails on 31b73d3. CodeRabbit and Kody reported no findings.

🤖 Generated with Claude Code

A Home load that was cut off when the app was suspended, or that failed
while a push woke the app in the background, left Home showing its
full-screen offline error. On iPhone and Mac nothing loaded Home again
when the app came back, because Home stays on screen while the app is
away and only loads when it appears. The error stayed up until the
person tapped Retry.

Home now knows when the app is in the background. A load that fails
there keeps the loading placeholder instead of the error, and Home loads
again as the app returns. A load that ended in an error while the app
was open is also retried on return. Apple TV already reloaded Home on
return; it now also skips showing a failure from the background.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

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

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99adac40-754f-4ad8-a8bd-32f79a93fb7c
📥 Commits

Reviewing files that changed from the base of the PR and between 860bb6f and 31b73d3.

📒 Files selected for processing (3)
  • iosApp/Tests/HomeSectionsMutationTests.swift
  • iosApp/iosApp/Screens/Home/HomeView.swift
  • iosApp/iosApp/Screens/Home/HomeViewModel.swift

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

📝 Walkthrough

Walkthrough

Home tracks background load failures and retries them when the app becomes active. Tests cover deferred retries after background and foreground failures, including avoiding another fetch after a successful retry.

Changes

Home Load Retry

Layer / File(s) Summary
Deferred load failure handling
iosApp/iosApp/Screens/Home/HomeViewModel.swift
HomeViewModel tracks background state and defers background failures. It keeps loading active while a retry is deferred and exposes reloadIfLastLoadFailed() to start a retry.
Scene activation and retry validation
iosApp/iosApp/Screens/Home/HomeView.swift, iosApp/Tests/HomeSectionsMutationTests.swift
HomeView updates background state from scene changes and requests a retry when the scene becomes active. Tests verify retries after background and foreground failures, and confirm that a later return does not trigger another fetch after success.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: blurbery

Merge Risk: ⚪ Minimal · up to 31b73

No actionable issue remains under the stated Home reload behavior. The change is mergeable after normal checks.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
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.
Description check Passed The description clearly explains the background-load failure, the reload-on-return behavior, affected platforms, implementation approach, validation, risks, and evidence.
Title check Passed The title concisely and accurately summarizes the primary change: reloading Home when the app returns after an interrupted load.
  • Fix all pre-merge checks with AI
✨ 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 evidence-required Needs before-and-after evidence before the Evidence check passes priority: P2 Limited scope, workaround exists, or polish labels Oct 12, 2026
@silo-triage

silo-triage Bot commented Oct 12, 2026

Copy link
Copy Markdown

The Evidence section covers iPhone, but the Approach also changes Home recovery on iPad and Mac and background-error handling on Apple TV. Please add before-and-after Home captures for those affected surfaces, plus a short background/return recording to show automatic recovery without tapping Try Again, as CONTRIBUTING.md requires for timing-dependent changes. If a surface cannot be captured, state the limitation for the maintainer to assess.

AI disclosure: Silo Triage using OpenClaw, model openai/gpt-6.1-sol; triage only, no code execution.

Home could still show the offline error after the app came back. If a
load was in flight when the app left, suspension could cut its request
off, and the failure arrived only after the app returned. The return
check had already run and found nothing to retry, so the late failure
put the error up.

Home now notes when a load is in flight while the app is in the
background. On return it starts a new load that replaces that one,
with a fresh request instead of joining the cut-off one. A replaced
load's late result or failure is ignored, so it cannot put up an error
or overwrite newer rows. The transient retry checks again after its
wait and, if the app has left, waits for the return instead of
sending a request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

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

Copy link
Copy Markdown
Contributor Author

The evidence page now covers the other surfaces, on the fixed build (740ea14):

  • iPhone and iPad: before and after captures. On main, Home comes back showing "Can't reach the server" and sends no new request. With the fix, Home reloads by itself.
  • Apple TV: before and after captures. On main, the error is visible for about a second before the existing return refresh replaces it. With the fix, no error frame appears.
  • Recordings: iPhone (about 22 s) and Apple TV (about 15 s), before and after, each showing the background and return without tapping Try Again.
  • Mac: not captured. The build Mac refuses screen capture over SSH, and running a Debug build there would change its signed-in Silo app. The page lists this and the other limitations.

Evidence: https://evidence.siloserver.org/r/silo-apple/pr-752/

@Quick104
Quick104 merged commit dfe26a2 into main Oct 13, 2026
9 checks passed
@Quick104
Quick104 deleted the fix/home-reload-after-suspension branch October 13, 2026 01:02
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 priority: P2 Limited scope, workaround exists, or polish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant