Skip to content

fix(mobile): ask a server's update status again when the read timed out - #52868

Merged
AmoabaKelvin merged 1 commit into
mainfrom
mobile-server-read-retry
Nov 30, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
mobile-server-read-retry

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On the phone's Edit computer, a server's update row could go missing for the whole visit, because the one status check for it timed out. Nothing asked again until you left the screen and came back. Now a check that didn't answer is retried a few times while you're on the screen.

Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​139 $\color{#cf222e}{\Huge{\mathbf{−}}}$​87 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52

What Changed

  • Before: Edit computer read each listed server's update status once per visit. A read that failed was asked again only when the screen's inputs changed (client, capabilities, server list, online). The server list keeps its identity while nothing in it changes. So a status read that timed out while the computer stayed connected left the server's row missing until the screen was reopened.
  • Now: a read that didn't answer is asked again after 15 s. The limits:
    • At most 3 retries per server per visit, checked whenever a read is sent, so a timer set for one server never re-asks another that has used its retries.
    • Only while Edit computer is in front and the app is in the foreground. Going to the background cancels the timer, and coming back asks what's still unanswered.
    • Only servers the computer lists as reachable, the same gate as before, so a retry never makes the desktop dial.
  • A failure that lands after the server list changed is retried by the current run, so a list change while a read was out loses nothing.
  • No behaviour change: the visit reader moved from HostServerUpdateRows.tsx to use-read-server-updates.ts to stay under the line cap.

Why

  • Root cause: the reader had no retry of its own and depended on its inputs changing, which a timeout doesn't cause.
  • Why a bounded, foreground-only retry: it fixes the missing row without adding steady polling. Answered servers are never asked twice in a visit, and nothing runs when nothing failed.

Linked Issue

No GitHub issue. This is a review follow-up to #52332.

Visual Proof

N/A: no new screens or copy. A row that a timed-out read left missing now appears after the retry, and a timeout can't be produced on demand on a device. Hook runs with fake timers are below.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

These ran the real hook under react-test-renderer, with fake timers and a fake desktop:

Case Reads
One timeout, then an answer 2, then none
Never answers 4 (1 plus 3 retries), then none
Two servers failing at different times 4 each
The server list changes while a read is out, then it fails retried (2)
Failure, then the app goes to the background for 2 minutes no reads while hidden; one read on return
Unmount or blur no further reads

No committed test: this is screen read scheduling, which the runs above cover. pnpm check:changed passes.

Performance

None when nothing fails: no timers and no extra reads. A failing server adds at most 3 reads per visit, at least 15 s apart. A single timer covers all servers. Work happens only while the screen is focused and the app is in the foreground, with no work while hidden.

Risk

Level: Low

  • Scope: phone only, with no RPC or host changes.
  • Riskiest part: an older server that keeps refusing the status read now gets 3 more cheap failed calls per visit.
  • Back out: a plain revert.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Reads keep their host scoping: relayed servers go through runtime:<env>, and SSH-managed servers through the desktop with skipTerminalCensus.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Edit computer read each server once per visit and asked again only when the server list changed, so
a status read that timed out while the computer stayed connected left the server's row missing until
the screen was reopened. A read that didn't answer is now asked again after 15 s, up to three times
per visit, and only while the screen is in front.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The server-update read logic moves from HostServerUpdateRows.tsx into the useReadServerUpdates hook. The hook reads updates under the existing focus, app activity, connectivity, host-list, and server-availability conditions. It retries failed or unanswered reads after 15 seconds, up to three times per server per visit. It also removes updates for unlisted servers and settles listed updates when focus ends.

Merge Risk: Low · up to 06cdf

The new retry logic can fire its retries early when the server list changes right after a failed read, so a server's update row may give up before the intended 15-second spacing has passed. Impact is limited to the Edit computer screen on the phone and to at most three extra reads per server per visit. It is mergeable, but the retry cooldown should be preserved across host-list changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a server's update status read is retried after a timeout. It matches the changeset, which adds a bounded retry for unanswered reads in the mobile Edit computer screen.…
Description check Passed The description follows the template sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checkli…
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: Title check

Explanation

The title names the main change: a server's update status read is retried after a timeout. It matches the changeset, which adds a bounded retry for unanswered reads in the mobile Edit computer screen. The title is specific and follows the fix(mobile) convention.

Full details: Description check

Explanation

The description follows the template sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the before and after behavior, the retry limits, the mechanism, and the risk with a back-out plan. It gives the performance reasoning and a visual proof N/A reason. Gaps: the Linked Issue section names no issue number (it cites a review follow-up to #52332 instead), the Risk level is given, and the 'Every added test fails without this change' box is unchecked, which the author explains by saying no test is committed. The Review and AI Disclosure sections are empty.

  • 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

@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: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e50b8e3-ce2a-4e28-8108-f2120f3d315d
Commits

Reviewing files that changed from the base of the PR and between 578fa6a and 06cdffe.

Files selected for processing: 2

  • mobile/src/host-screen/identity/updates/HostServerUpdateRows.tsx
  • mobile/src/host-screen/identity/updates/use-read-server-updates.ts

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

askUnanswered()
}, READ_RETRY_MS)
}
askUnanswered()

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.

Minor · Functional Correctness · Quick win

Preserve the retry cooldown when the host list changes.

If a read resolves false and hosts changes one second later, cleanup cancels the retry timer. The replacement run immediately reads the same server here. Repeated list changes can consume the retry budget without the required 15-second spacing.

Track the next eligible read time per key. Keep initial reads for newly listed servers immediate.

@AmoabaKelvin
AmoabaKelvin merged commit eb7b560 into main Nov 30, 2026
27 checks passed
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