Assistant: suppress repeated render-tool calls
All checks were successful
Deploy to VPS / test (push) Successful in 1m31s
Deploy to VPS / deploy (push) Successful in 2m1s

After the client returns a render tool's result, the model sometimes
re-issues the identical call with a fresh id on the follow-up run,
painting a second copy of the spending-summary card (observed live on
MAF 1.10 / CK 1.62). DeduplicateToolCallMiddleware now tracks which
render tools already ran in the current user turn and drops repeats —
their streamed TOOL_CALL_* events and their entries in the run's
MESSAGES_SNAPSHOT. The system prompt also tells the model the card is
already displayed once its "ok" result is present.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-07-04 18:10:51 -06:00
parent bbcfaa7808
commit eb400ab1e9
2 changed files with 62 additions and 0 deletions

View File

@@ -56,6 +56,9 @@ Generative UI — render tools:
nothing. The rendered card IS the complete response. Any text you write in
the same message as a render call will appear as a duplicate below the
card, which is wrong.
- When a render_spending_summary tool result ("ok") is already present for
the current question, the card is already on screen. Do NOT call the tool
again and do NOT add text — end your response with no further output.
"""