Repository navigation
fix(app): keep a failed chat reply and its Try Again while chat is paused - #22894
Conversation
|
The fix is correct and nicely scoped — I verified the failure mode and the guard against both call paths; nothing blocking from me.
USER IMPACT: Users who hit their chat usage cap no longer permanently lose a failed reply and its Try Again button by tapping retry while chat is paused — the retry just waits until the pause ends, and the composer keeps working. Nothing material left for me; optional nit if you touch this again: a test where by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Scoped bug fix: retryFailedReply dropped the failed reply and left sendingMessage stuck when chat was paused by the usage-budget gate. 6-line guard, test reproduces the stuck state on main, CI green.
What's wrong
When a reply fails, chat shows an error with Try Again. If the usage-budget pause turns on while that error is on screen (
ChatBudgetPausepolls every 30 s and on resume), the composer is hidden but the failed reply and its Try Again stay. Tapping Try Again then:sendingMessagestaystrue, because the chat page's_retryReplysets it before calling retry and only_streamReply'sfinallyclears it._load()), the composer comes back, butchatMutationInProgressis still true, so every send is ignored without any message.sendingMessagestuck)Change
retryFailedReplyreturns early while chat is paused. It keeps the failed reply and its retry, and releases the composer the caller locked. Retry after the pause ends works as before. This is a 6-line guard and no other paths change.Tests
test/providers/message_provider_failed_reply_test.dart: "Try Again while chat is paused keeps the failed reply and releases the composer". It fails a reply, applies an activeChatAtCap, and taps retry. The test expects nothing sent, the failed reply still last and retryable, andsendingMessagefalse. It then clears the pause and retries, which sends once and shows the reply. It fails on main because the failed reply vanishes.flutter test test/providers/message_provider_failed_reply_test.dart test/providers/message_provider_chat_reliability_test.dart test/providers/chat_history_state_test.dart: 49 passedbash test.sh: 6,743 passed, 23 skipped, exit 0UI-Evidence: none -- the visible change is that a failed reply is not removed on a tap that sends nothing; the provider test pins the reply, its retry and the composer lock.
Failure-Class: none