Repository navigation
Conversation
The issuance steps were called from the UI and ran on its dispatcher, e.g. resumeWithAuthCode was running in AndroidUiDispatcher according to a stack trace: signing DPoP proofs and attestations, parsing metadata and responses, and validating credentials ran between frames, and each resumption after a request waited for the UI thread. Every public suspend function of ProvisioningService now runs on Dispatchers.Default. Its callbacks only set StateFlows, and opening the browser is safe off the main thread on Android (application context, new task) and dispatches to the main queue on iOS. The cached clients and configuration, now read and written from several threads, are volatile.
gp-iaik
force-pushed
the
perf/provisioning-off-main
branch
from
October 30, 2026 10:07
89c1e81 to
f7f1acf
Compare
gp-iaik
changed the base branch from
feature/launchpad-2026-post
to
release/5.9.2-rc
October 30, 2026 10:07
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.
Stacked on
release/5.9.2-rc.The issuance steps ran on the dispatcher of their caller, i.e. the UI dispatcher. The stack trace of a failed token request shows
HttpClientKt.executeresumed fromAndroidUiDispatcher.performTrampolineDispatch. As a result:Changes
Every public suspend function of
ProvisioningServiceruns inoffMain { }, i.e.withContext(Dispatchers.Default):loadCredentialMetadata,parseCredentialMetadata,startProvisioningWithAuthRequest;resumeWithAuthCode,refreshCredential,decodeCredentialOffer;loadCredentialWithOffer,keepCredentialsUnderReview.This covers every caller, instead of changing each
LaunchedEffector view model.Callbacks are safe off the main thread:
onProgressisLoadingStatusService::setandstatusUpdaterisCredentialValidityService.updateStatus, both of which only set StateFlows.Opening the browser is safe off the main thread:
IntentService.openIntentcallsopenUrl, which uses the application context withFLAG_ACTIVITY_NEW_TASKon Android and dispatches to the main queue on iOS.The cached clients, client ID, and attestation flag are
@Volatile, as they are now accessed from several threads. Their check-then-act races are the same as before.Checks: ran
:androidApp:compileDebugKotlin,:shared:compileKotlinMetadataand:shared:testAndroidHostTest; all pass.Not done: issuing on a device; iOS.
🤖 Generated with Claude Code