Skip to content

fix: handle empty message on function call cancellation#72

Merged
Mikelarg merged 2 commits into
ai-forever:mainfrom
temrjan:fix/cancel-function-message
Mar 30, 2026
Merged

fix: handle empty message on function call cancellation#72
Mikelarg merged 2 commits into
ai-forever:mainfrom
temrjan:fix/cancel-function-message

Conversation

@temrjan

@temrjan temrjan commented Mar 28, 2026

Copy link
Copy Markdown

Summary

When a user cancels a tool call without leaving a comment, the message field is empty/None. Previously this produced a prompt like:

Прочитай его и реши, как действовать дальше: "None"

This caused the LLM to hallucinate as if the tool was actually executed.

Fix

Check if message is present before formatting. When empty, send a clear cancellation message:

Пользователь отменил вызов инструмента без комментария. Не выполняй этот вызов. Спроси пользователя, чем можешь помочь.

Changes

  • backend/giga_agent/middlewares/tool_result.py — add empty message handling in after_model

Fixes #32

Temrjan and others added 2 commits March 28, 2026 17:43
The provider name input always showed "Мой E2B провайдер" regardless
of selected provider type (local_docker, daytona, modal).

Fixes ai-forever#68

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When user cancels a tool call without a comment, the message field
is empty/None. Previously this produced a confusing prompt like
'Прочитай его: "None"', causing the LLM to hallucinate as if the
tool was executed.

Now sends a clear cancellation message instructing the LLM to stop
the tool call and ask the user for guidance.

Fixes ai-forever#32

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Mikelarg Mikelarg merged commit e6ccde1 into ai-forever:main Mar 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Поправить сообщение отмены функции

2 participants