-
Notifications
You must be signed in to change notification settings - Fork 67
fix(frontend): resolve infinite streaming spinner for new group chat members #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Warning Rate limit exceeded@feifei325 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 48 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA handling branch is added to the backend-subtask synchronization flow that finalizes AI streaming messages when the backend task completes. The code updates existing AI messages with final content, computes completion status, and preserves any errors from the subtask. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/features/tasks/contexts/chatStreamContext.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{py,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{py,ts,tsx,js,jsx}: All code comments MUST be written in English
File size MUST NOT exceed 1000 lines - split into multiple sub-modules if exceeded
Function length SHOULD NOT exceed 50 lines (preferred)
Files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
TypeScript/React MUST use strict mode, functional components, Prettier for formatting, ESLint for linting, single quotes, and no semicolons
Files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
TypeScript MUST use
constoverlet, never usevar
Files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
frontend/src/**/*.{ts,tsx}: MUST useuseTranslationhook imported from@/hooks/useTranslation, not fromreact-i18next
MUST use single namespace withuseTranslation()- never use array format likeuseTranslation(['common', 'groups'])
Frontend message data MUST always usemessagesfromuseUnifiedMessages()hook as the single source of truth for displaying messages - never useselectedTaskDetail.subtasks
Frontend i18n translation keys MUST use current namespace formatt('key.subkey')for keys within namespace andt('namespace:key.subkey')for cross-namespace keys
Files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
frontend/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Frontend MUST only use
NEXT_PUBLIC_*environment variables for client-safe values
Files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-31T03:47:12.173Z
Learnt from: CR
Repo: wecode-ai/Wegent PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T03:47:12.173Z
Learning: Applies to frontend/src/**/*.{ts,tsx} : Frontend message data MUST always use `messages` from `useUnifiedMessages()` hook as the single source of truth for displaying messages - never use `selectedTaskDetail.subtasks`
Applied to files:
frontend/src/features/tasks/contexts/chatStreamContext.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: E2E Tests (Shard 1/3)
- GitHub Check: E2E Tests (Shard 2/3)
- GitHub Check: Test Backend (3.10)
- GitHub Check: Test wegent CLI Integration
- GitHub Check: E2E Tests (Shard 3/3)
- GitHub Check: Test Frontend
🔇 Additional comments (1)
frontend/src/features/tasks/contexts/chatStreamContext.tsx (1)
1726-1755: Good fix for the streaming race condition.The logic correctly identifies and finalizes stale streaming messages when the backend has completed. The placement after the RUNNING/PENDING handling ensures this only runs for terminal states, and preserving
existingAiMessage.contentas a fallback handles cases where the streamed content is richer than the final backend value.
…members When a new member joins a group chat during an active AI stream: 1. syncBackendMessages creates a 'streaming' placeholder for RUNNING messages 2. If the stream completes before the user's WebSocket receives chat:done, the message stays in 'streaming' status indefinitely This fix adds a check in syncBackendMessages that updates streaming messages to their final status when the backend shows COMPLETED/FAILED/CANCELLED, preventing the infinite spinner issue.
42315b8 to
ac5a65c
Compare
Summary
syncBackendMessagesto update streaming messages to their final status when backend shows COMPLETED/FAILED/CANCELLEDProblem
When a new member joins a group chat during an active AI stream:
syncBackendMessagescreates a 'streaming' placeholder for RUNNING messageschat:done, the message stays in 'streaming' status indefinitelySolution
Added a check in
syncBackendMessagesthat detects when:status: 'streaming'RUNNINGorPENDING(i.e., it's COMPLETED, FAILED, or CANCELLED)When this condition is met, the message is updated with:
completedorerror)Test Plan
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.