@@ -4459,6 +4459,7 @@ it.layer(layerSharedApplicationDataPlaneTest)("snooze projection", (it) => {
44594459 const firstUpdatedAt = firstProjection . thread . updatedAt ;
44604460 assert . isNotNull ( firstSnoozedAt ) ;
44614461
4462+ yield * TestClock . adjust ( "1 minute" ) ;
44624463 yield * orchestrator . dispatch ( {
44634464 type : "thread.snooze" ,
44644465 commandId : CommandId . make ( "runtime-layer-snoozed-thread-snooze-again" ) ,
@@ -4470,7 +4471,11 @@ it.layer(layerSharedApplicationDataPlaneTest)("snooze projection", (it) => {
44704471 const thread = shell . threads . find ( ( candidate ) => candidate . id === threadId ) ;
44714472 assert . isDefined ( thread ) ;
44724473 assert . equal ( DateTime . formatIso ( thread . snoozedUntil ! ) , snoozedUntil ) ;
4473- assert . deepEqual ( thread . snoozedAt , firstSnoozedAt ) ;
4474+ // A same-time re-snooze re-acknowledges the thread without counting as activity.
4475+ assert . isNotNull ( thread . snoozedAt ) ;
4476+ assert . isTrue (
4477+ DateTime . toEpochMillis ( thread . snoozedAt ! ) > DateTime . toEpochMillis ( firstSnoozedAt ! ) ,
4478+ ) ;
44744479 assert . deepEqual ( thread . updatedAt , firstUpdatedAt ) ;
44754480
44764481 yield * orchestrator . dispatch ( {
@@ -4491,6 +4496,76 @@ it.layer(layerSharedApplicationDataPlaneTest)("snooze projection", (it) => {
44914496 assert . isNull ( awakened . thread . snoozedAt ) ;
44924497 } ) ,
44934498 ) ;
4499+
4500+ // Clients treat a failed thread's updatedAt as its failure edge, so a
4501+ // background refresh bumping it would wake the thread from snooze.
4502+ it . effect ( "keeps background pull request sync out of the persisted updatedAt" , ( ) =>
4503+ Effect . gen ( function * ( ) {
4504+ const projects = yield * ProjectService . ProjectService ;
4505+ const orchestrator = yield * Orchestrator . OrchestratorV2 ;
4506+ const projectId = ProjectId . make ( "runtime-layer-pr-sync-project" ) ;
4507+ const threadId = ThreadId . make ( "runtime-layer-pr-sync-thread" ) ;
4508+ const key = { host : "github.com" , repository : "owner/repository" , number : 42 } ;
4509+
4510+ yield * projects . create ( {
4511+ commandId : CommandId . make ( "runtime-layer-pr-sync-project-create" ) ,
4512+ projectId,
4513+ title : "PR sync projection" ,
4514+ workspaceRoot : "/tmp/runtime-layer-pr-sync-project" ,
4515+ } ) ;
4516+ yield * orchestrator . dispatch ( {
4517+ type : "thread.create" ,
4518+ createdBy : "user" ,
4519+ creationSource : "web" ,
4520+ commandId : CommandId . make ( "runtime-layer-pr-sync-thread-create" ) ,
4521+ threadId,
4522+ projectId,
4523+ title : "PR sync thread" ,
4524+ modelSelection,
4525+ runtimeMode : "full-access" ,
4526+ interactionMode : "default" ,
4527+ branch : null ,
4528+ worktreePath : null ,
4529+ } ) ;
4530+ yield * orchestrator . dispatch ( {
4531+ type : "thread.pull-request.link" ,
4532+ commandId : CommandId . make ( "runtime-layer-pr-sync-link" ) ,
4533+ threadId,
4534+ ...key ,
4535+ url : "https://github.com/owner/repository/pull/42" ,
4536+ source : "manual" ,
4537+ } ) ;
4538+ const linkedShell = yield * orchestrator . getShellSnapshot ( ) ;
4539+ const linkedUpdatedAt = linkedShell . threads . find ( ( t ) => t . id === threadId ) ?. updatedAt ;
4540+ assert . isDefined ( linkedUpdatedAt ) ;
4541+
4542+ yield * TestClock . adjust ( "1 minute" ) ;
4543+ yield * orchestrator . dispatch ( {
4544+ type : "thread.pull-request-link.sync" ,
4545+ commandId : CommandId . make ( "runtime-layer-pr-sync-sync" ) ,
4546+ threadId,
4547+ ...key ,
4548+ snapshot : {
4549+ state : "open" ,
4550+ title : "Ship it" ,
4551+ headBranch : "feature" ,
4552+ baseBranch : "main" ,
4553+ isDraft : false ,
4554+ updatedAt : "2026-08-27T00:00:00.000Z" ,
4555+ syncedAt : "2026-08-27T00:00:00.000Z" ,
4556+ closedAt : null ,
4557+ mergedAt : null ,
4558+ } ,
4559+ stack : null ,
4560+ } ) ;
4561+
4562+ const shell = yield * orchestrator . getShellSnapshot ( ) ;
4563+ const thread = shell . threads . find ( ( candidate ) => candidate . id === threadId ) ;
4564+ assert . isDefined ( thread ) ;
4565+ assert . equal ( thread . pullRequests ?. [ 0 ] ?. snapshot ?. title , "Ship it" ) ;
4566+ assert . deepEqual ( thread . updatedAt , linkedUpdatedAt ) ;
4567+ } ) ,
4568+ ) ;
44944569} ) ;
44954570
44964571it . layer ( layerSharedApplicationDataPlaneTest ) ( "visited projection" , ( it ) => {
0 commit comments