@@ -37,7 +37,7 @@ describe("github-copilot connection-bound response IDs", () => {
3737 expect ( input [ 4 ] ?. id ) . toMatch ( / ^ m s g _ [ a - f 0 - 9 ] { 16 } $ / ) ;
3838 } ) ;
3939
40- it ( "preserves valid reasoning IDs regardless of encrypted_content" , ( ) => {
40+ it ( "preserves valid reasoning IDs but strips encrypted_content" , ( ) => {
4141 const withEncrypted = Buffer . from ( `reasoning-${ "e" . repeat ( 24 ) } ` ) . toString ( "base64" ) ;
4242 const withNull = Buffer . from ( `reasoning-${ "n" . repeat ( 24 ) } ` ) . toString ( "base64" ) ;
4343 const withoutField = Buffer . from ( `reasoning-${ "a" . repeat ( 24 ) } ` ) . toString ( "base64" ) ;
@@ -47,25 +47,26 @@ describe("github-copilot connection-bound response IDs", () => {
4747 { id : withoutField , type : "reasoning" } ,
4848 ] ;
4949
50- expect ( rewriteCopilotConnectionBoundResponseIds ( input ) ) . toBe ( false ) ;
51- expect ( input [ 0 ] ?. id ) . toBe ( withEncrypted ) ;
52- expect ( input [ 1 ] ?. id ) . toBe ( withNull ) ;
53- expect ( input [ 2 ] ?. id ) . toBe ( withoutField ) ;
50+ expect ( rewriteCopilotConnectionBoundResponseIds ( input ) ) . toBe ( true ) ;
51+ expect ( input [ 0 ] ) . toEqual ( { id : withEncrypted , type : "reasoning" } ) ;
52+ expect ( input [ 1 ] ) . toEqual ( { id : withNull , type : "reasoning" } ) ;
53+ expect ( input [ 2 ] ) . toEqual ( { id : withoutField , type : "reasoning" } ) ;
5454 } ) ;
5555
56- it ( "preserves valid base64-ish reasoning IDs with and without encrypted content " , ( ) => {
56+ it ( "strips encrypted_content from valid reasoning IDs at payload send time " , ( ) => {
5757 const withEncrypted = "abcDEF0123+/=" ;
5858 const withoutEncrypted = "reasoning/abc+123=" ;
5959 const input = [
6060 { id : withEncrypted , type : "reasoning" , encrypted_content : "opaque-encrypted-payload" } ,
6161 { id : withoutEncrypted , type : "reasoning" } ,
6262 ] ;
6363
64- expect ( sanitizeCopilotReplayResponseIds ( input ) ) . toBe ( false ) ;
65- expect ( input . map ( ( item ) => item . id ) ) . toEqual ( [ withEncrypted , withoutEncrypted ] ) ;
64+ expect ( sanitizeCopilotReplayResponseIds ( input ) ) . toBe ( true ) ;
65+ expect ( input [ 0 ] ) . toEqual ( { id : withEncrypted , type : "reasoning" } ) ;
66+ expect ( input [ 1 ] ) . toEqual ( { id : withoutEncrypted , type : "reasoning" } ) ;
6667 } ) ;
6768
68- it ( "drops unsafe reasoning replay item IDs while keeping idless reasoning replay " , ( ) => {
69+ it ( "drops unsafe reasoning IDs and strips encrypted_content from kept items " , ( ) => {
6970 const overlongId = `5PX6gLHXT5wE+Y2tPmUV4gn+${ "B" . repeat ( 384 ) } ` ;
7071 const input = [
7172 {
@@ -81,8 +82,8 @@ describe("github-copilot connection-bound response IDs", () => {
8182
8283 expect ( sanitizeCopilotReplayResponseIds ( input ) ) . toBe ( true ) ;
8384 expect ( input ) . toEqual ( [
84- { type : "reasoning" , encrypted_content : "missing-id" , summary : [ ] } ,
85- { id : "rs_valid" , type : "reasoning" , encrypted_content : "valid" , summary : [ ] } ,
85+ { type : "reasoning" , summary : [ ] } ,
86+ { id : "rs_valid" , type : "reasoning" , summary : [ ] } ,
8687 ] ) ;
8788 } ) ;
8889
0 commit comments