@@ -24,6 +24,7 @@ import { makeCodexSessionRuntime } from "./CodexSessionRuntime.ts";
2424
2525const ROOT = wireFixture . rootThreadId ;
2626const [ CHILD_A , CHILD_B ] = wireFixture . childThreadIds as [ string , string ] ;
27+ const MEMORY = "memory-consolidation-thread" ;
2728
2829/**
2930 * The captured sequence, extended with the shapes the live capture didn't
@@ -174,15 +175,44 @@ describe("CodexSessionRuntime collab integration", () => {
174175 const turnStartedB = byIndex . find ( ( entry ) => isTurnStarted ( entry , CHILD_B ) ) ;
175176 const registrationA = byIndex . find ( ( entry ) => isRegistration ( entry , CHILD_A ) ) ;
176177 const registrationB = byIndex . find ( ( entry ) => isRegistration ( entry , CHILD_B ) ) ;
178+ const rootThreadStarted = byIndex . find ( ( entry ) => entry . method === "thread/started" ) ;
177179 assert . isDefined ( turnStartedA ) ;
178180 assert . isDefined ( turnStartedB ) ;
179181 assert . isDefined ( registrationA ) ;
180182 assert . isDefined ( registrationB ) ;
183+ assert . isDefined ( rootThreadStarted ) ;
184+ const memoryThreadStarted = {
185+ ...rootThreadStarted ,
186+ params : {
187+ thread : {
188+ ...rootThreadStarted . params . thread ,
189+ id : MEMORY ,
190+ sessionId : MEMORY ,
191+ source : "unknown" ,
192+ threadSource : "memory_consolidation" ,
193+ } ,
194+ } ,
195+ } ;
196+ const memoryTurnStarted = {
197+ ...turnStartedA ,
198+ params : {
199+ ...turnStartedA . params ,
200+ threadId : MEMORY ,
201+ turn : { ...turnStartedA . params . turn , id : "memory-consolidation-turn" } ,
202+ } ,
203+ } ;
181204 const script = {
182205 rootThreadId : ROOT ,
183206 holdTurnOpen : true ,
184207 hangInterruptFor : CHILD_A ,
185- notifications : [ turnStartedA , registrationA , registrationB , turnStartedB ] ,
208+ notifications : [
209+ turnStartedA ,
210+ registrationA ,
211+ memoryThreadStarted ,
212+ memoryTurnStarted ,
213+ registrationB ,
214+ turnStartedB ,
215+ ] ,
186216 } ;
187217 // @effect -diagnostics-next-line preferSchemaOverJson:off
188218 NodeFS . writeFileSync ( scriptPath , JSON . stringify ( script ) , "utf8" ) ;
@@ -240,6 +270,10 @@ describe("CodexSessionRuntime collab integration", () => {
240270 "pre-registration child A must still receive the interrupt RPC" ,
241271 ) ;
242272 assert . isTrue ( interruptedThreads . has ( CHILD_B ) , "registered child B must be interrupted" ) ;
273+ assert . isTrue (
274+ interruptedThreads . has ( MEMORY ) ,
275+ "memory consolidation must be interrupted without appearing in chat" ,
276+ ) ;
243277 assert . isTrue ( interruptedThreads . has ( ROOT ) , "parent turn must be interrupted last" ) ;
244278
245279 yield * runtime . close ;
0 commit comments