Skip to content

fix: handle empty message on function call cancellation#72

Open
temrjan wants to merge 2 commits intoai-forever:mainfrom
temrjan:fix/cancel-function-message
Open

fix: handle empty message on function call cancellation#72
temrjan wants to merge 2 commits intoai-forever:mainfrom
temrjan:fix/cancel-function-message

Conversation

@temrjan
Copy link
Copy Markdown
Contributor

@temrjan temrjan commented Mar 28, 2026

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>
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.

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

1 participant