-
Notifications
You must be signed in to change notification settings - Fork 305
chat processing with typing indicators and batching support for msgs #685
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
|
commit: |
Claude Code ReviewSummarySolid implementation of chat message batching and typing indicators for AIChatAgent. The core logic is sound with good test coverage. Found one potential race condition that needs attention. Issues1. Race condition in batch mode processing (ai-chat-agent.ts:762-764) When processing completes and finds a new pending request, there's a window where the timer could fire while the new request is being scheduled: } finally {
this._isProcessingChat = false; // Processing lock released
// ← Race window: timer could fire here before _scheduleProcessing() resets it
if (this._pendingChatRequest) {
this._scheduleProcessing(); // This cancels old timer and creates new one
}
}If a timer from before processing started fires during this window, Fix: Set the lock before scheduling: } finally {
// Check for new request before releasing lock
if (this._pendingChatRequest) {
this._scheduleProcessing();
}
this._isProcessingChat = false;
}2. Missing test coverage Tests don't verify sequential mode works correctly. All tests use batch mode. Should add at least one test with Minor observations
The race condition is the only blocking issue - fix the lock ordering and this is good to merge. |
Documents new features from cloudflare/agents#685: - Chat processing modes (sequential and batch) for AIChatAgent - Typing indicator support via onInputChange and inputProps - Configuration options: chatProcessingMode, chatIdleTimeout, chatTypingTimeout - Updated useAgentChat API reference with new return values - Added comprehensive examples for both processing modes Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
This update documents new features from PR #685 (cloudflare/agents): - Chat processing modes (sequential vs batch) - Typing indicators for smart message batching - New AIChatAgent properties: chatProcessingMode, chatIdleTimeout, chatTypingTimeout - New useAgentChat returns: onInputChange, inputProps, sendTypingIndicator The documentation includes: - API reference updates for AIChatAgent class properties - Examples showing sequential and batch processing modes - React examples demonstrating typing indicator integration - Use cases and best practices for each mode These features enable better handling of conversational chat patterns where users send multiple rapid messages. Related PR: cloudflare/agents#685 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
the idea is to type more than one msg at a time
want to give users 2 options:
inspired by this ai chat agent should handle multiple inputs coming in at the same time #24