@@ -3296,6 +3296,103 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
32963296 } ) ,
32973297 ) ;
32983298
3299+ it . effect ( "persists each merge queue removal wake across reactor restarts" , ( ) =>
3300+ Effect . gen ( function * ( ) {
3301+ const orchestrator = yield * Orchestrator . OrchestratorV2 ;
3302+ const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
3303+ const threadId = ThreadId . make ( "queue-removal-watch" ) ;
3304+ const projectId = ProjectId . make ( "queue-removal-project" ) ;
3305+ yield * seedProject ( {
3306+ projectId,
3307+ title : "Queue removal" ,
3308+ workspaceRoot : "/workspace/watch" ,
3309+ defaultModelSelection : null ,
3310+ createdAt : "2026-10-01T00:00:00.000Z" ,
3311+ } ) ;
3312+ yield * orchestrator . dispatch ( {
3313+ type : "thread.create" ,
3314+ createdBy : "user" ,
3315+ creationSource : "web" ,
3316+ commandId : CommandId . make ( "queue-removal-create" ) ,
3317+ threadId,
3318+ projectId,
3319+ title : "Queue removal" ,
3320+ modelSelection,
3321+ runtimeMode : "full-access" ,
3322+ interactionMode : "default" ,
3323+ branch : null ,
3324+ worktreePath : null ,
3325+ } ) ;
3326+ yield * orchestrator . dispatch ( {
3327+ type : "thread.pull-request.watch" ,
3328+ commandId : CommandId . make ( "queue-removal-start" ) ,
3329+ threadId,
3330+ host : "github.com" ,
3331+ repository : "pingdotgg/t3code" ,
3332+ number : 7 ,
3333+ watching : true ,
3334+ link : { url : "https://github.com/pingdotgg/t3code/pull/7" , source : "agent" } ,
3335+ } ) ;
3336+ let removal : PullRequestDetail [ "mergeQueueRemoval" ] ;
3337+ const host = Layer . mergeAll (
3338+ NodeServices . layer ,
3339+ Layer . mock ( PullRequestService . PullRequestService ) ( {
3340+ watchFingerprint : ( ) =>
3341+ Effect . succeed ( { status : removal ?. id ?? "green" , remarks : "none" } ) ,
3342+ invalidate : ( ) => Effect . void ,
3343+ detail : ( ) =>
3344+ Effect . succeed ( {
3345+ ...watchedPullRequestDetail ( { projectId, number : 7 , at : "2026-10-02T12:00:00.000Z" } ) ,
3346+ checks : [ { name : "lint" , status : "success" , description : null , url : null } ] ,
3347+ ...( removal === undefined ? { } : { mergeQueueRemoval : removal } ) ,
3348+ } ) ,
3349+ activity : ( ) =>
3350+ Effect . succeed ( {
3351+ comments : [ ] ,
3352+ commentCount : 0 ,
3353+ commentsTruncated : false ,
3354+ reviewThreads : [ ] ,
3355+ commits : [ ] ,
3356+ } ) ,
3357+ } ) ,
3358+ ) ;
3359+ const reactor = yield * PullRequestWatchReactor . make . pipe ( Effect . provide ( host ) ) ;
3360+ yield * reactor . sweep ;
3361+ yield * worker . drain ( ) ;
3362+ removal = {
3363+ id : "first" ,
3364+ removedAt : "2999-01-01T00:00:00Z" ,
3365+ reason : "Required checks failed" ,
3366+ } ;
3367+ yield * reactor . sweep ;
3368+ yield * worker . drain ( ) ;
3369+ const persisted = ( yield * orchestrator . getThreadShell ( threadId ) ) ?. pullRequests ?. [ 0 ] ?. watch ;
3370+ assert . equal ( persisted ?. mergeQueueRemovalId , "first" ) ;
3371+ const restarted = yield * PullRequestWatchReactor . make . pipe ( Effect . provide ( host ) ) ;
3372+ yield * restarted . sweep ;
3373+ yield * worker . drain ( ) ;
3374+ removal = { ...removal , id : "second" } ;
3375+ yield * restarted . sweep ;
3376+ yield * worker . drain ( ) ;
3377+ yield * restarted . sweep ;
3378+ yield * worker . drain ( ) ;
3379+ const { messages } = yield * orchestrator . getThreadRecords ( threadId , [ "messages" ] ) ;
3380+ const removals = messages . filter (
3381+ ( message ) => message . notification ?. summary === "#7: removed from merge queue" ,
3382+ ) ;
3383+ assert . lengthOf ( removals , 2 ) ;
3384+ for ( const message of removals ) {
3385+ assert . equal ( message . notification ?. outcome , "failed" ) ;
3386+ assert . include ( message . text , "Required checks failed" ) ;
3387+ }
3388+ assert . equal (
3389+ ( yield * orchestrator . getThreadShell ( threadId ) ) ?. pullRequests ?. [ 0 ] ?. watch
3390+ ?. mergeQueueRemovalId ,
3391+ "second" ,
3392+ ) ;
3393+ } ) ,
3394+ ) ;
3395+
32993396 it . effect . each ( [
33003397 "single page" ,
33013398 "paginated" ,
0 commit comments