fix: route GPT 5.6 Luna to Responses API + tool call flush + reasoning (#93) - #97
Merged
Merged
Conversation
Root cause of thinking not showing:
1. OpenCode Go docs require gpt-5.6-luna on /v1/responses endpoint,
NOT chat-completions. Our routing was sending to chat-completions.
2. Reasoning payload format was wrong: we sent { reasoning_effort: "medium" }
(chat-completions format) instead of { reasoning: { effort: "medium" } }
(Responses API format).
3. buildResponsesRequestBody() did not include thinkingPayload at all.
Fixes:
- Route ALL GPT models to Responses API (per OpenCode Go docs)
- Fix reasoning payload to nested format: { reasoning: { effort } }
- Add thinkingPayload to buildResponsesRequestBody()
- Add openai thinking family (off/low/medium/high/xhigh)
- Flush tool calls when finish_reason is null (gateway bug)
- Add diagnostic logging for empty responses
Fixes #93
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.
Summary
Fix GPT 5.6 Luna on OpenCode Go — model was unusable in agent mode (tool calling) and reasoning/thinking was not working.
Root Causes Found
finish_reason: nullon final chunk instead of"tool_calls"; extractor only flushed on exact matchbuildResponsesRequestBody()did not include thinkingPayload{ reasoning_effort }(chat-completions format) instead of{ reasoning: { effort } }(Responses API format)gpt-5.6-lunamissing from metadata and fallback listsChanges
src/routing.ts— Route ALL GPT models to Responses API (per OpenCode Go docs)src/streaming.ts— Flush tool calls when finish_reason is null; add diagnostic logging for empty responsessrc/thinking.ts— Addopenaithinking family (off/low/medium/high/xhigh); fix reasoning payload to nested formatsrc/extension.ts— Addgpt-5.6-lunato Go metadata + fallback; addresponsesUrlto Go provider; addopenaito thinking settings + picker; add thinkingPayload tobuildResponsesRequestBody()src/metadata.ts— Addgpt-5.6-lunalimits (1.05M context, 128K output) + snapshotdocs/issues/41-20260803-gpt56-luna-routing-fix.md— Full investigation docTesting
npm run compilepassesVerification
Verified that OpenCode Go docs require
gpt-5.6-lunaon/v1/responsesendpoint:Fixes #93