Skip to content

fix(route): sync bot public key before requests - #6726

Open
SeniorZhai wants to merge 1 commit into
masterfrom
fix/route-api-public-key
Open

SeniorZhai wants to merge 1 commit into
masterfrom
fix/route-api-public-key

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T07:00:36.581122Z dbfd478 PR opened
🔒 Security Review ✅ Completed 2026-10-08T06:44:05.420830Z dbfd478 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +39 to +41
defaultErrorHandle(MixinResponse<T>(requireNotNull(sessionResponse.error)))
endBlock?.invoke()
return null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +43 to +45
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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