Repository navigation
fix(route): sync bot public key before requests - #6726
SeniorZhai wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbfd47850e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| defaultErrorHandle(MixinResponse<T>(requireNotNull(sessionResponse.error))) | ||
| endBlock?.invoke() | ||
| return null |
There was a problem hiding this comment.
Route bootstrap errors through caller failure handling
When the key is absent after a fresh install or account switch and fetchSessionsSuspend returns an API error, this branch calls only defaultErrorHandle and returns without notifying failureBlock or exceptionBlock. For example, FetchWalletViewModel.importWallet enters IMPORTING at line 524 and only transitions to IMPORT_ERROR in those callbacks at lines 612–623; because it supplies no endBlock, the import UI remains stuck loading after this failure. Provide a dedicated session-sync failure callback or otherwise notify callers without treating a session 404 as a wallet 404.
Useful? React with 👍 / 👎.
| val publicKey = sessionResponse.data?.firstOrNull { it.userId == ROUTE_BOT_USER_ID }?.publicKey | ||
| check(!publicKey.isNullOrBlank()) { "Route bot public key is missing" } | ||
| preferences.putString(PREF_ROUTE_BOT_PK, publicKey) |
There was a problem hiding this comment.
Persist the prefetched bot session in the participant database
This stores the newly fetched key only in preferences, unlike the existing authentication-retry path, which also updates ParticipantSession. After switching back to an account, preferences are cleared while that account's database is retained; if the database contains a pre-rotation route key, this preflight can fetch the current key but leave the stale database row intact. A later UserRepository.getBotPublicKey(..., false) reads that row and overwrites the current preference, and RefreshDappJob does exactly that before its direct route request; its 401 branch refreshes the key but does not retry the failed dapp fetch. Save the returned session alongside the preference so the database cannot restore a superseded key.
Useful? React with 👍 / 👎.
No description provided.