Skip to content

A chat turn that ends without an answer sends a failure line #925

Open

Description

@czpython

What happens

A chat agent answers on Slack, GitHub, or WhatsApp. It calls its tools, and then its last message holds no text. With #922, the person then gets "The reply is unavailable. Send the message again to retry." The agent may have done the work, and only the answer is missing. The person sends the message again, and the agent does the work a second time.

Why

Message.answer in backend/druks/chat/models.py is the text after the agent's last tool call. When that text is empty, it gives DELIVERY_FAILED_MESSAGE. Druks never asks the agent for the missing answer.

Proposal

Do what OpenClaw and Hermes do: ask the agent once for its answer, and send the failure line only when the agent still gives none.

  • OpenClaw makes one more model call with no tools. It tells the model to "produce the final user-visible answer now" and not to repeat completed tool calls. When that call fails too, the person gets "Agent couldn't generate a response. Please try again." (src/agents/embedded-agent-runner/run/incomplete-turn-recovery.ts)
  • Hermes nudges the model once and retries. It calls an empty reply after real tool work "a choke", and it does not send the earlier text in its place. (agent/turn_empty_response.py)

In Druks, the retry can be an internal message, like the messages that report a run's outcome. When a channel turn ends with no text after its last tool call, finish_turn adds an internal message instead of sending the failure line, for example "[Internal: Your turn ended with no answer for the person. Write the answer now from what you already did. Do not call a tool again.]". deliver_pending delivers it as the next turn. When the turn that answers this message is empty too, the person gets DELIVERY_FAILED_MESSAGE, so Druks asks once only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions