Repository navigation
Conversation
…quest-id is absent
The stream kept reasoning_details only from deltas that also carried reasoning text, and wrote the accumulated text over the last item. On OpenRouter that dropped every opaque part before the replay: Gemini's thought signature (reasoning.encrypted), Anthropic's signature on reasoning.text, and OpenAI's reasoning.encrypted beside its summary; it also turned OpenAI's summary item into one with both summary and text. Pieces are now merged into items by type and index, so Gemini's encrypted item, which shares index 0 with its text item, stays its own item. Text and summary concatenate; signature, data and id are set by the piece that carries them. A piece that arrives after the text or the tool call reopens the reasoning block under the same ID, so the block's end carries it. The replay sends the items of every reasoning part unchanged. The metadata namespace becomes openai-chat, as upstream's, and parts stored under minimax still replay. The tests stream chunks recorded from OpenRouter on 2026-10-13 for Gemini, GPT and Claude and check the replayed request.
…e stream" This reverts commit 9821109. Upstream felinics#118 merges reasoning_details in wire order and supersedes the type+index merge here; the late-piece fix is proposed separately in felinics#122. This branch goes back to the errorformat and openai models fixes only.
ix64
added a commit
to ix64/twilight
that referenced
this pull request
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
用 ChatGPT 账号的令牌(Sign in with ChatGPT)调用
https://api.openai.com/v1时,openai-responses有两处信息丢失:{"detail":"..."},没有error对象;请求 ID 放在x-oai-request-id,没有x-request-id。DecodeOpenAI两者都不读,*sdk.APIError只剩状态码,Message和RequestID为空。GET /v1/models返回{"models":[{"slug":...,"visibility":...}]},没有data。ListModels返回空列表和 nil error,看起来像是没有模型。改动
errorformat.ParseOpenAI:error 对象没有 message 时,用detail作为Message。字符串原样保留,其他 JSON 值转成紧凑文本。两者都有时 error 对象的 message 优先。codex 和 OpenRouter 的解码器也调用ParseOpenAI,一并生效。errorformat.DecodeOpenAI:没有x-request-id时读x-oai-request-id,再退到x-amzn-requestid。responses和completions的ListModels:响应里没有data数组(缺失或为 null)时返回错误;"data": []仍是合法的空列表。做法和openai/transcription一致。没有解析models[].slug:这是 ChatGPT 令牌专有的格式,调用方本来也要按visibility过滤。detail错误体是 2026-10-10 从/v1/responses原样录入的(带temperature、stream: false、模型gpt-4o)。/v1/models响应里截取了 2 个条目的 3 个字段。原响应 614 KB,含 Codex 的提示词,不放进仓库。验证
go build、go vet、go test -short -race ./...和internal/sdkdiff的测试均通过,go mod tidy无 diff。把新测试放到 main 的代码上跑,TestDecodeOpenAI、TestDecodeOpenAIDetail和两个TestListModels_NoDataArray都失败。--new-from-rev main为 0 个问题。gpt-6.1-sol:ProviderOptions的托管web_search、同一请求两次序列化字节相同。temperature:400,Message为Unsupported parameter: temperature,RequestID有值。v0.7.1 下两者都为空。Message为The 'gpt-does-not-exist' model is not supported when using Codex with a ChatGPT account.,RequestID有值。v0.7.1 下两者都为空。Stream must be set to true,带RequestID。invalid_api_key,Kind 为authentication,和 v0.7.1 一致。ListModels返回list models: response has no data array。v0.7.1 返回空列表。ListModels只有单元测试;Codex 后端(provider/openai/codex)是否也返回detail错误体,没有实测。