AP-25179-Agent-Chat-Widget-shows-message-placeholder#36
Open
AP-25179-Agent-Chat-Widget-shows-message-placeholder#36
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where error messages weren't properly terminating the loading state, causing the chat widget to block users from making new requests. The fix ensures that error messages are treated as terminal messages alongside AI messages without tool calls.
Changes:
- Modified terminal message detection to include error messages
- Added comprehensive test coverage for error message handling in the loading state
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/agents/chat_app/src/stores/chat.ts | Updated addMessages to treat error messages as terminal, triggering finishLoading |
| src/agents/chat_app/src/stores/tests/chat.test.ts | Added test suite covering terminal message handling for both AI and error messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| store.config = createConfig(); | ||
|
|
||
| const errorMessage = createErrorMessage("Task failed successfully"); | ||
| store.addMessages([errorMessage as any], true); |
There was a problem hiding this comment.
The as any type assertion bypasses type safety. If createErrorMessage returns a type incompatible with Message[], consider updating the type definition or the function signature instead of using a type assertion.
Suggested change
| store.addMessages([errorMessage as any], true); | |
| const errorMessages = [errorMessage] as unknown as Parameters<typeof store.addMessages>[0]; | |
| store.addMessages(errorMessages, true); |
6929b5d to
a2e538f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, errors would block the user from making new requests due to the empty poll handling.