Skip to content

feat(mobile): lock chat input while bot is responding + 20s timeout#1537

Closed
felixmuinde wants to merge 56 commits into
we-promise:mainfrom
chancenhq:fix/mobile-chat-input-lock
Closed

feat(mobile): lock chat input while bot is responding + 20s timeout#1537
felixmuinde wants to merge 56 commits into
we-promise:mainfrom
chancenhq:fix/mobile-chat-input-lock

Conversation

@felixmuinde
Copy link
Copy Markdown
Contributor

@felixmuinde felixmuinde commented Apr 21, 2026

Summary

  • Input lock: send button and Enter shortcut are disabled for the full response lifecycle (isSendingMessage || isWaitingForResponse), not just during the initial HTTP POST. Prevents users from queuing up multiple messages while a response is in flight.
  • 20s timeout: if the bot never responds (stuck poll), the waiting flag resets automatically, an error message is surfaced, and the input unlocks — no manual refresh needed.
  • _isWaitingForResponse flag: tracks the full polling cycle from _startPolling to _stopPolling, exposed as a getter so the UI can react to it.

Test plan

  • Send a message — send button disabled until response fully arrives
  • Try typing and hitting Enter mid-response — should not send
  • Simulate a stuck response (e.g. kill network) — input should unlock after 20s with error message
  • Normal flow unaffected — button re-enables cleanly after response stabilises

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added polling timeout mechanism to chat conversations, preventing hanging requests during extended message exchanges.
    • Enabled continuous automated security analysis of codebase.
  • Bug Fixes

    • Fixed message send button behavior to properly prevent sending while waiting for assistant response.
  • Chores

    • Set up automated CI/CD deployment pipeline with multi-architecture container support and AWS cloud integration.

guillermotti and others added 30 commits September 25, 2025 13:20
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Updated regex for Docker image tag matching in deployment script.

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Refactor deployment logic to handle alpha and beta tags more clearly, removing unnecessary beta deployment conditions.

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
jjmata and others added 24 commits January 27, 2026 12:46
- 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>
@superagent-security superagent-security Bot added the contributor:verified Contributor passed trust analysis. label Apr 21, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 449d30db-823d-4cb5-a52e-427619dafd09

📥 Commits

Reviewing files that changed from the base of the PR and between b3c88e0 and a7b0fbd.

⛔ Files ignored due to path filters (1)
  • mobile/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/codeql.yml
  • .github/workflows/deploy.yml
  • mobile/lib/providers/chat_provider.dart
  • mobile/lib/screens/chat_conversation_screen.dart
  • terraform/.terraform.lock.hcl
  • terraform/main.tf
  • terraform/providers.tf

📝 Walkthrough

Walkthrough

The pull request introduces CI/CD infrastructure with CodeQL security analysis and automated Docker image deployment to AWS ECR, adds a polling timeout mechanism to the mobile chat provider, updates message send gating logic to account for response waiting states, and establishes Terraform infrastructure for AWS ECR repository provisioning with OIDC-based authentication.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/codeql.yml, .github/workflows/deploy.yml
Added CodeQL analysis workflow triggering on pushes/PRs to main and weekly schedule with multi-language support. Added deployment workflow triggering on version tags that builds multi-arch Docker images, pushes to AWS ECR, and conditionally updates Helm values in production platform repository based on tag patterns (beta, alpha).
Mobile Chat Provider
mobile/lib/providers/chat_provider.dart, mobile/lib/screens/chat_conversation_screen.dart
Added 20-second polling timeout to chat provider that halts polling and sets error message on timeout. Updated send message gating to disable send when either sending or waiting for response state is active.
Terraform Infrastructure
terraform/providers.tf, terraform/main.tf
Established Terraform configuration with S3 backend, AWS provider setup, and infrastructure for AWS ECR repository named sure with image tag immutability and push-time scanning. Added IAM policy document for cross-account ECR access and GitHub OIDC role module for CI/CD authentication.
Terraform Lock File
terraform/.terraform.lock.hcl
Added dependency lock entry for hashicorp/aws provider version 5.100.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Suggested labels

infra/tooling

Poem

🐇 A pipeline flows from code to cloud,
ECR repositories standing proud,
Polling timeouts keep us sage,
While GitHub Actions turn the page—
Infrastructure blooms, and messages ring true! 🚀

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@superagent-security superagent-security Bot added the pr:verified PR passed security analysis. label Apr 21, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7b0fbdbdc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +390 to 392
onPressed: (chatProvider.isSendingMessage || chatProvider.isWaitingForResponse)
? null
: _sendMessage,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep input lock tied to polling completion

This enable/disable gate now depends on isWaitingForResponse, but that flag is still cleared in ChatProvider._pollForUpdates as soon as the first assistant token arrives, before _stopPolling() ends the response lifecycle. In streaming replies, the send controls re-enable while the previous assistant response is still in flight, so users can submit overlapping prompts again despite the intended single in-flight lock.

Useful? React with 👍 / 👎.

Comment on lines +286 to +288
if (_pollingStartTime != null &&
DateTime.now().difference(_pollingStartTime!) >= _pollingTimeout) {
_stopPolling();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Timeout only stalled polls, not active responses

This timeout condition uses elapsed time since polling started and aborts after 20s even when the assistant is actively producing content. Any legitimate long response (or one that completes close to the 20s mark) can be truncated and surfaced as an error because polling is stopped before fetching the next update, and the timer is never extended when progress is observed.

Useful? React with 👍 / 👎.

@felixmuinde felixmuinde deleted the fix/mobile-chat-input-lock branch April 21, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants