Repository navigation
Conversation
send() waited for the background job (background?.join()). After 6 exchanges a summary runs after every answer and reads every older turn first, so on a slow phone each question could wait tens of seconds before its own work started. ChatScreen.tsx stops that task instead (cancelBackgroundTask). stopBackground() cancels the job (one that hasn't started never starts; one that has throws, so a half-written title or summary is never saved) and cancels the native generation in progress, then waits for it to return.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Approve. Checked against the prompt-cache refill I added at the end of the background
|
|
@coderabbitai review |
|
A new question stops the background title or summary
Builds on #76 (CI, including the app compile step added there); the last commit is this PR's.
Finding 3 of the review.
send()started withbackground?.join()(ChatViewModel.kt:199): the question waited for the chat title (the 2nd question of every new chat) or the summary (after every answer once a chat passes 6 exchanges). A summary reads every older turn before writing, so on a slower phone a question could wait tens of seconds before its own retrieval even started. The Expo app stops that task instead (cancelBackgroundTaskinChatScreen.tsx).stopBackground()replaces the join:background.cancel(): a title or summary that hasn't started never starts, and one that has throws out ofSummarize.title/summary, sosetTitle/setSummarynever save a half-written result;session.cancel(): stops the native prompt reading (checked between batches) or writing in progress;A stopped title leaves the question as the chat's title (what it shows until the model writes one). A stopped summary is written after a later answer, as in the Expo app. Your planned prefix refill at the end of the background job is unaffected: a stopped job just doesn't reach it, and the answer reads the prefix itself.
Not measured. The app has no unit tests for
ChatViewModel; CI only compiles it (#76). I haven't built or run it (no Android toolchain here), so it needs a check on a phone: in a new chat, send a second question right after the first answer; it should start without waiting for the title. No CodeRabbit CLI review was run before pushing (crisn't installed here).