BRIC-18: Fix duplicate HUMAN messages and tool error handling#24
Conversation
- Add _is_duplicate_human_message() to SendMessageUseCase and StreamMessageUseCase to prevent duplicate HUMAN messages when stream crashes and client retries - Patch ToolNode._handle_tool_errors=True to catch all tool errors (including Pydantic ValidationError from hallucinated params) instead of only ToolInvocationError - Add openWhenHidden:true in chatApi.ts (composable-ui) to prevent fetchEventSource from reconnecting on tab visibility - Add docstring warnings on MCP tools to discourage hallucinated params - Update QA test for read_bricks_document to use document_id + project_unique_id instead of file_url - Add 19 unit tests for dedup logic and tool error patching
🔍 Code Review — BRIC-18Score : 8/10 — Bonne PR, des fixes ciblés et bien testés. Quelques points à améliorer ci-dessous. ✅ Ce qui est bien1. Logique de déduplication (
2. Patch ToolNode error handling
3. Nouveau fichier de tests
4. Import ordering
|
| Critère | Note |
|---|---|
| Correction des bugs | ✅ Les 2 bugs sont bien fixés |
| Couverture de tests | ✅ 19 nouveaux tests, bonne couverture unitaire |
| Documentation | ✅ Docstrings claires, NOTE sur le trade-off |
| Architecture | |
| Robustesse | |
| Style | ✅ Propre, cohérent |
Verdict : LGTM avec suggestions mineures. La duplication de _is_duplicate_human_message et le monkey-patch sont les deux points à adresser en follow-up. Pas bloquant pour le merge.
🚀 Score : 8/10
Jira
BRIC-18
Changes
_is_duplicate_human_message()toSendMessageUseCaseandStreamMessageUseCaseto prevent duplicate HUMAN messages when stream crashes and client auto-retries. Also addedopenWhenHidden: trueinchatApi.ts(composable-ui).ToolNode._handle_tool_errors=Trueso all tool errors (including PydanticValidationErrorfrom hallucinated params) are caught and surfaced to the LLM instead of crashing the graph.test_mcp_bricks_endpoints.pyto usedocument_id+project_unique_idinstead of deprecatedfile_url.Tests