ai: openai-compatible-chat rejects reasoning delivered as an encrypted object (Iceman)
Maintainer thường phản hồi trong vòng 1 ngày
@rsdenck đang làm issue này rồi.
Từ ngày 5/11/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/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ệ
- typescript
Hướng nghiên cứu
Issue chỉ đến packages/ai/src/protocols/openai-chat.ts, nơi schema của stream hiện yêu cầu reasoning là một chuỗi. Hãy bắt đầu bằng cách đọc schema đó và cách xử lý reasoning_details; tái hiện lỗi với một chunk được truyền trực tuyến có delta.reasoning là một object. Bản sửa được hoàn tất khi cấu trúc reasoning đã mã hóa không còn làm gián đoạn lượt và stream hoàn tất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When opencode-go/iceman-contributor-free streams encrypted reasoning, it sends choices[].delta.reasoning as a JSON object ({content, encrypted_content, summary}) instead of a string. The OpenAI-compatible Chat schema requires a string, so the whole turn fails with AI.Error.InvalidProviderOutput: Invalid opencode-go/openai-compatible-chat stream event. Plain turns succeed, which makes the failure look intermittent.
Environment
- opencode version: 2.1.4 (npm
@opencode/cli, latest channel; 2.2.5 also affected — see below) - OS: Windows 10.0.19045.7663 (win32 x64)
- Terminal:
TERM=xterm-256color(terminal app not reported) - Shell: bash (Git for Windows)
- Install/channel: global npm install, release
- Active plugins: none
Reproduction
-
POST to
https://opencode.ai/inference/go/openai/v1/chat/completionswithmodel: iceman-contributor-free,stream: true, one function tool, and a prompt that triggers a tool call. -
The streamed chunk that carries the tool call looks like this:
{ "choices": [ { "index": 0, "delta": { "role": "assistant", "content": null, "reasoning": { "content": null, "encrypted_content": "gAAAA...", "summary": null }, "tool_calls": [ { "id": "call_...", "type": "function", "function": { "name": "...", "arguments": "..." } } ] }, "finish_reason": "tool_calls" } ], "object": "chat.completion.chunk" } -
Select the same model in the TUI and send a prompt that makes the model think before answering or calling a tool.
Expected Behavior
The parser should tolerate this shape — map encrypted_content / summary into reasoning details (as it already does for reasoning_details) or ignore unsupported fields — and the turn should complete.
Actual Behavior
The turn aborts with:
AI.Error: Invalid opencode-go/openai-compatible-chat stream event
and the session fails to drain, producing no response. Relevant log line:
timestamp=2026-11-03T22:48:55.264Z level=ERROR message="Failed to drain Session" cause="AI.Error: Invalid opencode-go/openai-compatible-chat stream event ..."
Additional Context
-
Schema in
packages/ai/src/protocols/openai-chat.tsstill requires a string:reasoning: optionalNull(Schema.String),I checked this on
v2.2.5and ondev; upgrading from 2.1.4 does not fix it. -
Frequency: intermittent. Turns without an encrypted reasoning delta succeed; turns that stream the object fail. Same model, same session, minutes apart.
-
Workaround: switch to a different model.
-
Related (not duplicates): #40690 (tool-call stream validation), #37553 / #35283 (
delta.reasoningas a string being dropped, now handled).
- Ngôn ngữ chính
- TypeScript
- Star
- 224k
- Fork
- 30k
- Merge trung bình
- 6 giờ 16 phút
- Pull request đã merge (30 ngày)
- 507
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deletedCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anomalyco/opencode#62052 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
anomalyco/opencode#62046 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
desktop: "Open in <Editor>" menu in Review Pane opens workspace root directory instead of active file tabCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởpending close triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
anomalyco/opencode#62040 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
anomalyco/opencode#62024 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/opencode#61897 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
test-reliability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/azure-sdk-for-js#40672 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
HarperFast/studio#2067 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
liberation-data/drivine#639 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày