orca/mobile/src
Brennan Benson 7db0101bcb
fix(mobile): recover pairing saves from Android SecureStore failures (#11430)
* fix(mobile): recover pairing save when the Android keystore alias is unusable

Orca Mobile could reach a state where pairing succeeded but the host could
never be saved, with every attempt failing identically:

  Could not encrypt the value for key 'orca.host-token.host-...'
  under keychain 'key_v1'. Caused by: unknown

expo-secure-store derives ONE Android keystore alias from the keychain
service (`<service>:unauthenticated`) and shares it across every host token,
so a single unusable alias rejects all writes. Its built-in self-heal only
covers KeyPermanentlyInvalidatedException, and a null-message
GeneralSecurityException takes the unrecoverable branch instead — leaving
onboarding permanently blocked, which a reinstall does not clear.

Route host-token persistence through a keychain generation that rotates to a
fresh service (and therefore a fresh alias) only after a write has already
failed. Generation 0 keeps expo's default service so tokens written by
earlier builds stay readable, reads walk back through retired services, and
deletes clear every generation so a rotation cannot strand a live credential.

Refs #6600

* fix(mobile): record a keychain rotation before storing the token under it

Greptile flagged that a token could be stored under a generation the
generation record never captured. `commitGeneration` swallowed the
AsyncStorage failure and cached the new generation in memory, so the write
succeeded for the rest of the session — but the next launch re-read the old
record, and because reads only walk back from the recorded generation they
never probed the newer service. The host silently vanished and the user had
to re-pair, which is the same class of loss this change set out to fix.

Record the rotation first and let a storage failure propagate, so a token is
never written under a generation reads won't reach. Advancing the record
before the write is safe because reads walk back through every older service;
the worst case is one spent generation and one extra probe per miss.

* fix(mobile): harden pairing keychain recovery

* fix(mobile): harden pairing keychain recovery state

* fix(mobile): fail closed on unreadable pairing credentials
2026-07-30 17:29:41 -07:00
..
agent-history fix(ai-vault): resume a bridged Codex session under the selected account's home (#11224) 2026-07-28 15:18:07 -07:00
browser
cache
components fix(mobile): keep host action drawer close stable (#11306) 2026-07-28 23:50:53 -07:00
constants
diagnostics
dictation
files fix(mobile): recover unreliable relay connections (#10709) 2026-07-26 00:48:06 -07:00
hooks
layout
mobile-release
notifications fix: stop notification loss, credentialed cache reuse, and clipboard clobber (#11230) 2026-07-28 17:38:31 -07:00
onboarding
platform
session fix(test): stabilize system SSH transport integration (#11597) 2026-07-30 13:59:50 -07:00
source-control
storage feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
tasks fix(checks): rank successful checks above skipped and neutral (#11337) 2026-07-30 13:29:41 -07:00
terminal fix(mobile): keep terminal input composable while the connection is cut (#11463) 2026-07-30 17:23:01 -07:00
theme
transport fix(mobile): recover pairing saves from Android SecureStore failures (#11430) 2026-07-30 17:29:41 -07:00
worktree
accounts-route-reset-credit.test.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
host-edit-route-accessibility.test.ts
host-edit-save-flow.test.ts fix(mobile): keep a proxied wss host on :443 when editing (#11383) 2026-07-29 19:28:01 -07:00
host-route-action-state.test.ts
host-route-action-state.ts
host-route-exit.test.ts fix(mobile): pop to home when leaving a host so the back chevron animates backward (#9723) 2026-07-26 01:57:25 -07:00
host-route-exit.ts fix(mobile): pop to home when leaving a host so the back chevron animates backward (#9723) 2026-07-26 01:57:25 -07:00
mock-server-account-state.test.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
mock-server-key-pair.test.ts fix(mobile): harden native chat send budgets, streams, and stop (#10814) 2026-07-26 22:08:38 -07:00
mock-server-session-tabs-fixture.test.ts feat(mobile): add session.tabs.list handler to mock server (#9293) 2026-07-29 18:01:38 -07:00
mock-server-terminal-fixture-routing.test.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00