mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
* feat(mobile): lock chat input while bot is responding + 20s timeout - Add _isWaitingForResponse flag to ChatProvider; set in _startPolling, cleared in _stopPolling so it covers the full polling lifecycle not just the initial HTTP POST - Add _pollingStartTime + 20s timeout in _pollForUpdates; if the bot never responds the flag resets, errorMessage is surfaced, and input unlocks automatically - Gate send button and keyboard shortcut on isSendingMessage || isWaitingForResponse so users cannot queue up multiple messages while a response is in flight (adding an interrupt like with other chat bots would require a larger rewrite of the backend structure) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(mobile): make polling timeout measure inactivity not total duration Reset _pollingStartTime whenever assistant content grows so the 20s timeout only fires if no new content has arrived in that window. Prevents cutting off a slow-but-streaming response mid-generation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(mobile): lock input for full polling duration, not just until first chunk - Add isPolling getter to ChatProvider (true while _pollingTimer is active) - Gate send button and intent on isPolling in addition to isWaitingForResponse so users cannot submit overlapping prompts while a response is still streaming - Also auto-scroll while polling is active * Fix chat polling timeout race and send re-entry guard Polling timeout was evaluated before the network attempt, allowing it to fire just as a response became ready. Timeout check now runs after each poll attempt and only when no progress was made; network errors fall through to the same check instead of silently swallowing the tick. Added _isSendInFlight boolean to prevent rapid taps from re-entering _sendMessage() during the async token fetch window before provider flags are set. Guard is set synchronously at the top of the method and cleared in a finally block. * fix(mobile): prevent overlapping polls and empty-placeholder stop Add _isPollingRequestInFlight guard so Timer.periodic ticks are skipped if a getChat request is still in flight, preventing stale results from resetting state out of order. Fix empty assistant placeholder incorrectly triggering _stopPolling: stable is only declared when a previously observed length exists and hasn't grown. An initial empty message keeps polling until content arrives or the timeout fires. * fix(mobile): reset _lastAssistantContentLength in _stopPolling Prevents stale content-length state from a prior polling session bleeding into the next one. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>