Repository navigation
fix(app): preserve messages sent during history load and replace reply placeholder by identity - #22051
Conversation
…y placeholder by identity (BasedHardware#19232)
|
Verdict: this is a well-scoped, correct fix for two real message-loss bugs — happy to see it; a few non-blocking notes below, leaving the merge call to a human maintainer. What I verified:
Non-blocking notes:
UX: users will notice messages they sent during history load no longer vanish when loading completes, and a finished AI reply can no longer replace the wrong bubble when the list shifts mid-stream. Blast radius is confined to chat state management; no persistence, network, or schema changes. USER IMPACT: messages you send while chat history is still loading no longer disappear once loading finishes, and a completed AI reply can no longer overwrite the wrong bubble if the list moved mid-stream. This feedback is AI-generated maintainer assistance on behalf of the Omi maintainers; a human maintainer should make the final merge call. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks for the thorough review and verification, @Git-on-my-level! Noted on the non-blocking items:
Ready for human maintainer review and merge. |
|
Thanks for this fix, @ocakciomursel-pixel! Your commits are being carried forward in #25157 (cherry-picked with your original authorship intact) so they can land with the current CI and repo conventions. Closing this in favor of that branch — your contribution is credited there and in the git history. |
|
Hey @ocakciomursel-pixel 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
What changed and why
Closes #19232.
app/lib/providers/chat_history_state.dart):refreshMessagesnow recordsloadStartedand merges any messages added after the load began via_withSentWhileLoading(when not switching apps viadropdownSelected), deduplicating any human message the server already returned with the same text. Previously, a message added viaaddMessageLocally(or a voice turn insendVoiceMessageStreamToServer) before a pending history load completed was overwritten whenmessageswas replaced wholesale.app/lib/providers/message_provider.dart): BothsendVoiceMessageStreamToServerand_streamReplypreviously capturedfinal aiIndex = messages.length - 1before streaming and wrotemessages[aiIndex] = messageonMessageChunkType.done(andvoiceMessages.insert(aiIndex, ...)onMessageChunkType.message). Ifmessageswas merged or reordered while the stream was in flight, the final reply overwrote the wrong row. Added_replaceMessageand_insertBeforehelpers usingidentical(m, placeholder).Product invariants affected
none
How it was verified
Added regression unit tests in
app/test/providers/message_provider_chat_reliability_test.dartverifying both_withSentWhileLoadingpreservation/deduplication and identity-based placeholder replacement whenmessagesis modified mid-stream.Tests
app/test/providers/message_provider_chat_reliability_test.dartUI evidence
UI-Evidence: none -- state-management / provider-only fix with unit test coverage; no widget layout or visual styling changes.
Failure class (fixes)
Failure-Class: none