@@ -216,4 +216,37 @@ describe("Kiro completion through public server endpoints", () => {
216216 upstream . server . stop ( true ) ;
217217 }
218218 } ) ;
219+
220+ test ( "routed compaction with text.format summarizes instead of tripping the capability guard" , async ( ) => {
221+ const upstream = scriptedKiroUpstream ( [
222+ [ textFrame ( "Compaction summary of the earlier turns." ) ] ,
223+ ] ) ;
224+ saveConfig ( kiroConfig ( upstream . server . url . toString ( ) ) ) ;
225+ const proxy = startServer ( 0 ) ;
226+ try {
227+ const response = await originalFetch ( new URL ( "/v1/responses" , proxy . url ) , {
228+ method : "POST" ,
229+ headers : { "content-type" : "application/json" } ,
230+ body : JSON . stringify ( {
231+ model : "kiro-test/gpt-5.6-sol" ,
232+ stream : false ,
233+ input : [
234+ { type : "message" , role : "user" , content : [ { type : "input_text" , text : "earlier turn" } ] } ,
235+ { type : "compaction_trigger" } ,
236+ ] ,
237+ // Routed compaction must strip the structured-output request; before the strip,
238+ // Kiro's capability guard rejected the whole turn as unsupported text controls.
239+ text : { format : { type : "json_schema" , name : "answer" , schema : { type : "object" } } } ,
240+ } ) ,
241+ } ) ;
242+
243+ expect ( response . status ) . toBe ( 200 ) ;
244+ const json = await response . json ( ) as { output ?: Array < { type ?: string } > } ;
245+ expect ( ( json . output ?? [ ] ) . filter ( item => item . type === "compaction" ) ) . toHaveLength ( 1 ) ;
246+ expect ( upstream . requests ) . toHaveLength ( 1 ) ;
247+ } finally {
248+ await proxy . stop ( true ) ;
249+ upstream . server . stop ( true ) ;
250+ }
251+ } ) ;
219252} ) ;
0 commit comments