Repository navigation
Keep Server Health off the main thread while it opens - #1055
Merged
ivanfenenko merged 1 commit intoNov 15, 2026
Merged
Conversation
Android: opening Server Health decrypted every saved password through Android Keystore on Main (binder calls to keystore2), freezing the push transition for about 115 ms on a Pixel 9. The profile store now runs its Keystore reads and writes on Dispatchers.IO, and Server Health reads the profile catalog without passwords. Its week of pings and the report build on Dispatchers.Default, and live status no longer rebuilds the report. The Servers quick view loads off Main too. iOS: the 7-day SwiftData fetch and report build ran on the MainActor because the store's nonisolated async methods inherit the caller's actor. Server Health and the Servers quick view now fetch and build in @Concurrent functions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ivanfenenko
marked this pull request as ready for review
November 15, 2026 21:40
Collaborator
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 11fec85. Configure here.
There was a problem hiding this comment.
Automated review: 2 finding(s) that 2+ of 3 passes agreed on.
Outside the diff lines:
ios/OpenCode Mobile/OpenCode Mobile/UI/ServerHealth/ServerHealthViewModel.swift:143low: Concurrent rebuilds with the same range can apply out of order
2 finding(s) from a single pass, not posted
android/opencode-kit/src/main/java/dev/opencode/mobile/data/local/DataStoreConnectionProfileStore.kt:60high: saveProfile rollback can wipe a concurrent save (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/serverhealth/ServerHealthViewModel.kt:141medium: Stale range report overwrites the newly selected range (muse-spark-1.3-contributor)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.090
ivanfenenko
deleted the
fix/1053-server-health-page-stalls-while-opening
branch
November 15, 2026 22:48
This was referenced Nov 15, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#1053: opening Server Health (Servers > active profile > Details) stalled mid-transition.
On a Pixel 9, a Perfetto trace of one tap on Details showed:
keystore2binder calls for about 115 ms right after the push started, so no transition frames were drawn;Android
DataStoreConnectionProfileStoreruns its Keystore decrypts, writes and deletes onDispatchers.IO. Every caller that loaded profiles onviewModelScopewas paying this on Main.ConnectionProfileStore.catalogWithoutPasswords(). Server Health uses it because it only shows the name, protocol and active id.ServerHealthViewModelreads the week of pings and builds the report onDispatchers.Default. A live-status change now only updates the live fields instead of rebuilding the whole report on Main.ServersViewModelloads the quick view off Main.iOS
nonisolatedasync methods run on the caller's actor.ServerHealthViewModeland the Servers quick view now fetch and build in@concurrentfunctions. A range picked while a report is building still wins.The wider audit of main-thread reads on both platforms is in #1054.
Checks
:app:testDebugUnitTestand:opencode-kit:testDebugUnitTest, 3688 tests passing, plus a new test that fails if Server Health decrypts passwords.ServerHealthViewModelTests, 8 tests passing on the simulator.Risks / Follow-ups
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Touches connection profile loading and Keystore I/O threading; behavior should be unchanged but credential paths are security-sensitive and report timing/race handling shifted.
Overview
Fixes janky navigation when opening Server Health by moving expensive work off the UI thread on Android and iOS, without changing what the screens show.
On Android, Keystore password decrypts in
DataStoreConnectionProfileStorenow run onDispatchers.IO, and a realcatalogWithoutPasswords()path lets Server Health load profile name/protocol without decrypting. Server Health and the Servers quick view fetch up to a week (or a day) of pings and build reports onDispatchers.Default, with pre-builtBuiltHealthapplied inpublishso live updates don’t rebuild the full report on Main.On iOS, seven-day store reads and report building run in
@concurrenthelpers fromServerHealthViewModeland the Servers quick view, with guards so a newer range selection wins if the user changes range mid-build.Tests pin
workDispatcherto the test scheduler and add coverage that Server Health binding never calls password-decrypting store APIs.Reviewed by Cursor Bugbot for commit 11fec85. Bugbot is set up for automated code reviews on this repo. Configure here.