Skip to content

🔴 [CRITICAL BUG] After upgrade to latest version, reasoning and tool-call messages are completely LOST - only text remains #1130

@lzj960515

Description

@lzj960515

⚠️ Important Note Before Closing This Issue

This issue should NOT be closed until:

  1. ✅ The fix has been thoroughly tested with actual AI agent workflows including tool calls
  2. ✅ A test case has been added to prevent regression
  3. ✅ The developer has verified that reasoning, tool-call, AND text messages ALL persist correctly to the database

Please do not close this issue with just a code change. Test it properly first.


🔴 CRITICAL BUG: Message Persistence Only Saves Text - Reasoning and Tool-Call Messages Are Lost

Severity: HIGH

This bug breaks multi-turn conversations because the AI loses all context about its previous reasoning and tool calls. Without this information, the AI cannot make informed decisions in subsequent turns.

Bug Description

After upgrading @voltagent/core to the latest version (2.6.3), message persistence is broken:

  • ✅ Streaming output works correctly - all message types (reasoning, tool-call, text) are streamed properly
  • Database persistence only saves text type messages
  • reasoning and tool-call messages are completely lost when saved

Key Observation

This bug occurs whenever a tool call is invoked.

  • Without tool calls: reasoning messages are persisted correctly to the message table
  • With tool calls: only the final text response is saved, reasoning and tool-call are lost

Related PRs

The bug was likely introduced by the step-level persistence logic in #1067 and/or the deduplication fix in #1123.

Why This Is Critical

When the AI has a multi-turn conversation:

  1. Turn 1: AI reasons, calls tools, and responds
  2. Turn 2: AI loads history to understand context
  3. PROBLEM: History only contains text responses, NOT the reasoning or tool calls
  4. RESULT: AI is "blind" to its own previous thought process and tool results

This fundamentally breaks the agent's ability to have coherent multi-turn interactions.

Steps to Reproduce

  1. Upgrade @voltagent/core to version 2.6.3
  2. Run an AI agent that invokes at least one tool
  3. Check the persisted messages in database
  4. Observe that only text type messages exist, no reasoning or tool-call

Expected Behavior

All message types should be persisted to the message table:

- reasoning messages (AI's thought process)
- tool-call messages (tools invoked)
- tool-result messages (tool outputs)  
- text messages (final responses)

Actual Behavior

When tool calls are involved, only:

- text messages (final responses only)

Environment

  • @voltagent/core: 2.6.3
  • Database: PostgreSQL with @voltagent/postgres

Request

Please:

  1. Test message persistence with tool calls explicitly - not just streaming
  2. Verify that reasoning messages are saved to the database even when tools are called
  3. Add a regression test that checks database records after tool invocation
  4. Test multi-turn conversations with tool calls to ensure context is preserved

Frustration

This is the second major regression in message handling introduced by the step-level persistence feature:

Both issues affect the core functionality of the agent. Please invest time in proper testing before releasing fixes. Quick fixes without verification are causing more harm than good.


Thank you for addressing this. Please ensure thorough testing before closing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions