mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b941298cc1
The tool-rendering, frontend-tools-async, and hitl-in-app fixtures all gated their first-leg (tool-emitting) vs. follow-up (narration) responses on `hasToolResult: false/true` and/or `turnIndex`. Those constraints count the *entire* thread, so once a user clicked a tool-using pill the thread already contained tool messages and assistant turns and subsequent pill clicks fell through to the wrong branch — d20 dropped from 5 rolls to 3, Chain tools emitted no cards, query_notes returned narration without the Notes DB card, and the second HITL pill never raised an approval dialog. Re-key every follow-up fixture on the prior step's `toolCallId` (the matcher checks `messages[last].tool_call_id`), drop the global `hasToolResult` gates from the tool-emitting fixtures, and reorder so the toolCallId-specific fixtures come first under first-match-wins. The d20 chain becomes a linear toolCallId graph (`call_tr_d20_seq_001` → `_002` → … → `_005`), Chain tools gets disambiguators for each of its three parallel tool_call_ids, and Weather/AAPL/query_notes/HITL approve+reject branches all gate on the specific request_user_approval / get_weather / query_notes / get_stock_price id that landed last. userMessage matchers are unchanged. Adds Playwright multi-pill regression tests to the four affected demos that click every pill sequentially in one thread and assert the full card counts: - tool-rendering-default-catchall: Find flights → 5 d20 rolls (with 20 last) - tool-rendering-custom-catchall: 1 flights + 5 d20 + 3 chain = 9 cards - frontend-tools-async: 3 NOTES DB cards with the right keyword per pill - hitl-in-app: refund approve then escalate, each with its own dialog