openaiprovider: Chat tool continuation drops reasoning_content from the originating assistant message

Đang mở
#1,409 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@nicksin-leroux đang làm issue này rồi.

Từ ngày 20/11/2026.

  • #1410 của @nicksin-leroux — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
ai-infra-agents

Hướng nghiên cứu

Start in the Go Chat Completions provider path used by openaiprovider.NewChatCompletionsAgent and trace how the assistant response is added to the automatic tool loop. Add a regression test with the fake HTTP transport and local lookup tool described in the issue. Done means the immediate follow-up includes the supplied reasoning_content, omits it when absent, and does not carry it into unrelated later turns.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

When a Chat Completions endpoint returns reasoning_content alongside a tool call, the Go Chat provider omits that field from the assistant message on the next request. The tool runs and its result is paired with the correct call. However, an endpoint that requires the original field can reject the follow-up instead of completing the answer. We’ve observed this requirement with Kimi.

Reproduced on both v0.3.1 and main at 045c7be52783e6ae383c816cf9c64310f8d25240, using openaiprovider.NewChatCompletionsAgent and the standard automatic tool loop with streaming disabled.

How to reproduce

Use a fake HTTP transport and one local lookup tool. No API key or live endpoint is needed.

  1. Have the transport return a completion with finish_reason: "tool_calls" and this assistant message:
{
  "role": "assistant",
  "content": "I'll look that up.",
  "reasoning_content": "synthetic-marker",
  "tool_calls": [{
    "id": "call_1",
    "type": "function",
    "function": {"name": "lookup", "arguments": "{}"}
  }]
}
  1. Let the automatic loop execute lookup. Inspect the messages array in the next HTTP request.

Actual: The assistant message still contains call_1, and the tool result references call_1, but reasoning_content is missing.

Expected: For endpoints that require it, the assistant message containing call_1 should retain the exact value "synthetic-marker" on that immediate follow-up. If the endpoint didn’t supply the field, it should remain absent. The value shouldn’t appear in visible output, logs or unrelated later turns.

Related work and proposed contribution

PR #630 preserves reasoning that has already reached the automatic tool loop. This case occurs one step earlier: the Chat provider doesn’t carry the endpoint’s reasoning_content field into that loop.

We’ll open a PR linked to this issue with a proposed fix and a regression test. The test will check that reasoning_content is returned with the matching tool result when supplied, stays absent when omitted, and isn’t carried into unrelated later turns.

Ngôn ngữ chính
Go
Star
683
Fork
70
Merge trung bình
17 giờ 50 phút
Pull request đã merge (30 ngày)
64

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/agent-framework-go

Tất cả issue của microsoft/agent-framework-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.