@@ -40,15 +40,17 @@ vitest.mock("../fetchers/modelCache", () => ({
4040 "glm-5.1" : { ...opencodeGoModels [ "glm-5.1" ] } ,
4141 // Anthropic-format model used to exercise the /v1/messages path.
4242 "qwen3.7-max" : { ...opencodeGoModels [ "qwen3.7-max" ] } ,
43- // Responses-format model (Zoo-Code-Org/Zoo-Code#1431).
43+ // Responses-format models (Zoo-Code-Org/Zoo-Code#1431 and issue #1979 ).
4444 "gpt-5.6-luna" : { ...opencodeGoModels [ "gpt-5.6-luna" ] } ,
45+ "gpt-6-luna" : { ...opencodeGoModels [ "gpt-6-luna" ] } ,
4546 } )
4647 } ) ,
4748 refreshModels : vitest . fn ( ) . mockImplementation ( function ( ) {
4849 return Promise . resolve ( {
4950 "glm-5.1" : { ...opencodeGoModels [ "glm-5.1" ] } ,
5051 "qwen3.7-max" : { ...opencodeGoModels [ "qwen3.7-max" ] } ,
5152 "gpt-5.6-luna" : { ...opencodeGoModels [ "gpt-5.6-luna" ] } ,
53+ "gpt-6-luna" : { ...opencodeGoModels [ "gpt-6-luna" ] } ,
5254 } )
5355 } ) ,
5456 getModelsFromCache : vitest . fn ( ) . mockReturnValue ( undefined ) ,
@@ -833,7 +835,7 @@ describe("OpencodeGoHandler", () => {
833835 } )
834836 } )
835837
836- describe ( "Responses-format models (gpt-5.6-luna)" , ( ) => {
838+ describe ( "Responses-format models (gpt-5.6-luna, gpt-6-luna )" , ( ) => {
837839 // gpt-5.6-luna is Responses-only on the Go gateway: its chat-completions
838840 // adapter fails with an opaque HTTP 500 (Zoo-Code-Org/Zoo-Code#1431),
839841 // so the handler must route it through /v1/responses and never fall
@@ -842,6 +844,10 @@ describe("OpencodeGoHandler", () => {
842844 opencodeGoApiKey : "test-key" ,
843845 opencodeGoModelId : "gpt-5.6-luna" ,
844846 }
847+ const gpt6LunaOptions : ApiHandlerOptions = {
848+ opencodeGoApiKey : "test-key" ,
849+ opencodeGoModelId : "gpt-6-luna" ,
850+ }
845851
846852 beforeEach ( ( ) => {
847853 mockResponsesCreate . mockImplementation ( async ( ) =>
@@ -982,6 +988,21 @@ describe("OpencodeGoHandler", () => {
982988 expect ( mockAnthropicCreate ) . not . toHaveBeenCalled ( )
983989 } )
984990
991+ it ( "routes gpt-6-luna streaming through responses.create only" , async ( ) => {
992+ const handler = new OpencodeGoHandler ( gpt6LunaOptions )
993+ const messages : Anthropic . Messages . MessageParam [ ] = [ { role : "user" , content : "Hi" } ]
994+
995+ const chunks = await collectStream ( handler . createMessage ( "sys" , messages ) )
996+
997+ expect ( chunks ) . toContainEqual ( { type : "text" , text : "Hello" } )
998+ expect ( mockResponsesCreate ) . toHaveBeenCalledWith (
999+ expect . objectContaining ( { model : "gpt-6-luna" , stream : true } ) ,
1000+ expect . anything ( ) ,
1001+ )
1002+ expect ( mockCreate ) . not . toHaveBeenCalled ( )
1003+ expect ( mockAnthropicCreate ) . not . toHaveBeenCalled ( )
1004+ } )
1005+
9851006 it ( "streams text and reasoning chunks from the Responses event stream" , async ( ) => {
9861007 const handler = new OpencodeGoHandler ( lunaOptions )
9871008 const messages : Anthropic . Messages . MessageParam [ ] = [ { role : "user" , content : "Hi" } ]
@@ -1315,6 +1336,20 @@ describe("OpencodeGoHandler", () => {
13151336 expect ( callArgs . temperature ) . toBeUndefined ( )
13161337 } )
13171338
1339+ it ( "completePrompt routes gpt-6-luna through responses.create only" , async ( ) => {
1340+ mockResponsesCreate . mockResolvedValue ( { output_text : "Luna 6 response" } )
1341+ const handler = new OpencodeGoHandler ( gpt6LunaOptions )
1342+
1343+ expect ( await handler . completePrompt ( "ping" ) ) . toBe ( "Luna 6 response" )
1344+
1345+ expect ( mockResponsesCreate ) . toHaveBeenCalledWith (
1346+ expect . objectContaining ( { model : "gpt-6-luna" , store : false } ) ,
1347+ expect . anything ( ) ,
1348+ )
1349+ expect ( mockCreate ) . not . toHaveBeenCalled ( )
1350+ expect ( mockAnthropicCreate ) . not . toHaveBeenCalled ( )
1351+ } )
1352+
13181353 it ( "forwards Responses-specific max_output_tokens and reasoning in completePrompt" , async ( ) => {
13191354 mockResponsesCreate . mockResolvedValue ( { output_text : "Hello!" } )
13201355 const handler = new OpencodeGoHandler ( { ...lunaOptions , includeMaxTokens : true , modelMaxTokens : 7_500 } )
@@ -1364,6 +1399,7 @@ describe("OpencodeGoHandler", () => {
13641399
13651400 it ( "classifies documented Responses models as Responses-format and other models as not" , ( ) => {
13661401 expect ( isOpencodeGoResponsesFormatModel ( "gpt-5.6-luna" ) ) . toBe ( true )
1402+ expect ( isOpencodeGoResponsesFormatModel ( "gpt-6-luna" ) ) . toBe ( true )
13671403 expect ( isOpencodeGoResponsesFormatModel ( "grok-4.5" ) ) . toBe ( false )
13681404 expect ( isOpencodeGoResponsesFormatModel ( "grok-4.6" ) ) . toBe ( true )
13691405 expect ( isOpencodeGoResponsesFormatModel ( "muse-spark-1.3-contributor" ) ) . toBe ( true )
0 commit comments