Problem
When doing multiple swaps in one message (e.g. "badger and req sell for usdc"), the UI renders artifact/duplicate quote boxes. Swaps execute serially (correct) but all cards render simultaneously, and failed cards stay fully expanded.
tk ticket: sa-lgqo
Repro: Request 2+ swaps in one message. Observe redundant quote boxes.
Root Cause (3 factors)
- Simultaneous card rendering with serial execution — Both
InitiateSwapUI mount at once but execution is serialized via withWalletLock. Second card shows full quote but stepper is stuck waiting.
- Failed swaps leave full cards visible — No collapsed/minimized state for completed or failed swaps.
- LLM retries in multi-step loop — With
stepCountIs(5), LLM may retry failed swaps, producing a third card.
Proposed Fix
Option C (minimal): Auto-collapse completed/failed swap cards to single-line summary so only active swap shows full detail.
Key Files
apps/agentic-chat/src/components/tools/InitiateSwapUI.tsx — needs collapsed state
apps/agentic-chat/src/components/tools/useSwapExecution.tsx
apps/agentic-chat/src/lib/walletMutex.ts — serializes ops but UI unaware
apps/agentic-chat/src/components/AssistantMessage.tsx — renders tool parts independently
Acceptance Criteria
Problem
When doing multiple swaps in one message (e.g. "badger and req sell for usdc"), the UI renders artifact/duplicate quote boxes. Swaps execute serially (correct) but all cards render simultaneously, and failed cards stay fully expanded.
tk ticket:
sa-lgqoRepro: Request 2+ swaps in one message. Observe redundant quote boxes.
Root Cause (3 factors)
InitiateSwapUImount at once but execution is serialized viawithWalletLock. Second card shows full quote but stepper is stuck waiting.stepCountIs(5), LLM may retry failed swaps, producing a third card.Proposed Fix
Option C (minimal): Auto-collapse completed/failed swap cards to single-line summary so only active swap shows full detail.
Key Files
apps/agentic-chat/src/components/tools/InitiateSwapUI.tsx— needs collapsed stateapps/agentic-chat/src/components/tools/useSwapExecution.tsxapps/agentic-chat/src/lib/walletMutex.ts— serializes ops but UI unawareapps/agentic-chat/src/components/AssistantMessage.tsx— renders tool parts independentlyAcceptance Criteria