fix: fix get_message_event_type return wrong message type#32019
fix: fix get_message_event_type return wrong message type#32019fatelei wants to merge 1 commit intolanggenius:mainfrom
Conversation
Summary of ChangesHello @fatelei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where the system was incorrectly classifying messages containing user-uploaded files as having a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where user-uploaded images were incorrectly triggering MESSAGE_FILE stream events, causing the LLM text response to not render in the chat interface. The root cause was that get_message_event_type() was checking for any file associated with a message, without distinguishing between user-uploaded files and assistant-generated files.
Changes:
- Added a filter to query only assistant-generated files (
belongs_to == "assistant") when determining message event type - Added comprehensive test coverage for both user and assistant file scenarios
- Added regression tests to prevent this issue from recurring
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
api/core/app/task_pipeline/message_cycle_manager.py |
Added belongs_to == "assistant" filter to SQL query in get_message_event_type() to only check for AI-generated files |
api/tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py |
Updated and added tests to cover user files, assistant files, and regression scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug where the message event type was being incorrectly determined when a user uploads a file. The fix in get_message_event_type to filter for assistant-owned files is appropriate. The accompanying tests are thorough and validate the fix, including regression tests for the specific issue. I've noted an opportunity to reduce some duplication in the new tests for better long-term maintainability.
api/tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py
Outdated
Show resolved
Hide resolved
3284a7c to
7181aa3
Compare
d0c3e4b to
dad9006
Compare
61e7956 to
d36dd6d
Compare
|
Hi @fatelei, thanks for fixing the However, there's still a missing piece that prevents vision responses from rendering. The def _message_end_to_stream_response(self) -> MessageEndStreamResponse:
self._task_state.metadata.usage = self._task_state.llm_result.usage
metadata_dict = self._task_state.metadata.model_dump()
return MessageEndStreamResponse(
task_id=self._application_generate_entity.task_id,
id=self._message_id,
metadata=metadata_dict,
# files field is missing
)Even with your fix, the frontend can't render vision responses because:
I've implemented the fix in PR #31925 which:
The two PRs complement each other - both are needed to fully resolve #31888. Should I add this to your PR or keep it separate? |
Important
Fixes #<issue number>.Summary
fix #31888
Screenshots
before
Screen.Recording.2026-02-05.at.22.32.47.mov
after
Screen.Recording.2026-02-05.at.22.30.28.mov
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods