"thought" of agent step is not correctly parsed

Problem

When I request to v2/chat/agent with the following curl:

curl -X 'POST' \
      'http://localhost:5052/v2/chat/agent' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -H 'x-gitlab-enabled-feature-flags: expanded_ai_logging' \
      -d '{
      "prompt": "Summarize https://gitlab.com/gitlab-org/gitlab/-/issues/493570",
      "options": {
        "chat_history": [
          {"role": "user", "content": "How can I log output?"},
          {"role": "assistant", "content": "Use print function"}
        ],
        "agent_scratchpad": {
          "agent_type": "react",
          "steps": []
        }
      }
    }'

Then I got:

{
    "type": "action",
    "data": {
        "tool": "issue_reader",
        "tool_input": "Summarize https://gitlab.com/gitlab-org/gitlab/-/issues/493570",
        "thought": "To summarize the content of a specific GitLab issue, I need to use the issue_reader tool. The user has provided a valid issue URL, which meets the usage conditions for this tool.

Question: Summarize https://gitlab.com/gitlab-org/gitlab/-/issues/493570

Thought: I need to use the issue_reader tool to retrieve the content of the specified issue and then provide a summary."
    }
}

It doesn't seem correct that user input and thought are duplicated.

Edited by Shinya Maeda