Skip to content

fix(ai): show accurate toast when local model is loading or downloading#2486

Merged
mikib0 merged 4 commits into
developmentfrom
fix/local-model-loading-message
May 24, 2026
Merged

fix(ai): show accurate toast when local model is loading or downloading#2486
mikib0 merged 4 commits into
developmentfrom
fix/local-model-loading-message

Conversation

@mikib0

@mikib0 mikib0 commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When the user sends a message while in local AI mode and the model is not yet ready, the toast message was always "Model not ready. Download the local model first." — even when the model was already downloaded and actively loading
  • Now shows a state-specific message based on modelStatus:
    • downloading → "Model is still downloading, please wait."
    • preparing / checking → "Model is still loading, please wait."
    • idle / other → "Download the local model first."

Test plan

  • Set AI mode to Local, send a message while model is in preparing state — confirm toast says "Model is still loading, please wait."
  • Send a message while model is downloading — confirm toast says "Model is still downloading, please wait."
  • Send a message with no model downloaded (idle) — confirm toast says "Download the local model first."

Summary by CodeRabbit

  • New Features
    • AI chat error messages now show context-specific feedback based on the model’s current status (downloading, preparing, or not ready), improving clarity when submitting messages.
    • Localization for AI model status was refined with shorter, clearer prompts and additional loading/downloading messages to better guide users during model setup and updates.

Review Change Stack

'Model not ready. Download the local model first.' was shown for all
non-ready model states, including when the model was already downloaded
and actively loading (preparing/checking). Now shows a state-specific
message so users are not told to download a model that is already present.
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The PR adds status-aware local-AI error toasts and i18n strings, converts Expo auth error constructors/callers to object-style parameters, nests a JWT option under jwks, and refactors captureApiException to accept an options object with updated call sites across API routes and services. A small biome.json ignore entry was added.

Changes

AI Model Status Toast Updates

Layer / File(s) Summary
Status-aware AI model toast and localization
apps/expo/app/(app)/ai-chat.tsx, apps/expo/lib/i18n/locales/en.json
Error toast title now branches on modelStatus (downloading / preparing / fallback not-ready). Added modelStillLoading and modelStillDownloading; shortened modelNotReady text.

Expo auth error shape changes

Layer / File(s) Summary
Auth error API and hook call sites
apps/expo/features/auth/lib/authErrors.ts, apps/expo/features/auth/hooks/useAuthActions.ts
AuthClientError constructor and toAuthError now take a single object parameter; all useAuthActions error conversions updated to toAuthError({ source, fallback }).

JWT plugin option shape

Layer / File(s) Summary
JWT jwks option nesting
packages/api/src/auth/auth.config.ts, packages/api/src/auth/index.ts
disablePrivateKeyEncryption is now passed under jwks: { ... } to the jwt(...) plugin call.

Sentry captureApiException refactor

Layer / File(s) Summary
Sentry util and API call-site updates
packages/api/src/utils/sentry.ts, many packages/api/src/... route and service files
captureApiException signature changed to a single options-object ({ error } & SentryOperationContext); numerous API route/service catch blocks updated to call captureApiException({ error, ... }) while preserving operation, tags, and extra metadata.

Tooling

Layer / File(s) Summary
Biome ignore entry
biome.json
Added !**/.expo to files.includes ignore entries.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

ci/cd

Suggested reviewers

  • andrew-bierman
  • Isthisanmol
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving toast messages when the local AI model is loading or downloading by showing state-specific feedback instead of a generic message.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/local-model-loading-message

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

mikib0 added 2 commits May 24, 2026 15:37
…Biome ignore

Move disablePrivateKeyEncryption under the jwks key where JwtOptions expects it,
and exclude .expo auto-generated files from Biome checks.
@github-actions github-actions Bot added the api label May 24, 2026
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for API Unit Tests Coverage (./packages/api)

Status Category Percentage Covered / Total
🔵 Lines 95.02% (🎯 95%) 726 / 764
🔵 Statements 95.02% (🎯 95%) 726 / 764
🔵 Functions 100% (🎯 97%) 44 / 44
🔵 Branches 95.45% (🎯 92%) 294 / 308
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/api/src/utils/sentry.ts 0% 100% 100% 0% 8-73
Generated in workflow #1457 for commit 2da980e by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Expo Unit Tests Coverage (./apps/expo)

Status Category Percentage Covered / Total
🔵 Lines 97.56% (🎯 95%) 560 / 574
🔵 Statements 97.56% (🎯 95%) 560 / 574
🔵 Functions 100% (🎯 97%) 51 / 51
🔵 Branches 95% (🎯 92%) 190 / 200
File CoverageNo changed files found.
Generated in workflow #1457 for commit 2da980e by the Vitest Coverage Report Action

captureApiException, toAuthError, and AuthClientError constructor all
had 2 parameters, violating the no-owned-max-params lint rule.
Each is refactored to accept a single options object; all call sites updated.
@mikib0 mikib0 merged commit e528c76 into development May 24, 2026
11 of 15 checks passed
@mikib0 mikib0 deleted the fix/local-model-loading-message branch May 24, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant